Exemple #1
0
def putLugar(id):
    try:
        print(request.is_json)
        if request.is_json:

            content = request.json

            status = LugarDB.putLugar(id, content)

            if status == 0:
                return Httpstatus.ok_server_put('ok')

            elif status == 1:

                return Httpstatus.not_found('not found')

            else:

                return Httpstatus.int_server('server error')

        else:
            return Httpstatus.bad_request('bad request')

    except Exception as e:
        print(e)
        return Httpstatus.int_server('server error')
def putMove(id):
    try:
        print(request.is_json)
        if request.is_json:

            content = request.json
            print(content)

            status = TypemovesDB.putMove(id, content)

            if status == 0:
                return Httpstatus.ok_server_put('ok')

            elif status == 1:

                return Httpstatus.not_found('not found')

            else:

                return Httpstatus.int_server('server error')

        else:
            return Httpstatus.bad_request('bad request')

    except:
        print('error')
        return Httpstatus.int_server('server error')
def PutDevice(name):

    try:

        if request.is_json:

            content = request.json

            status = InventDB.putDevice(content, name)

            if status == 0:
                return Httpstatus.ok_server_put('ok')

            elif status == 1:

                return Httpstatus.not_found('not found')

            else:

                return Httpstatus.int_server('server error')

        else:
            return Httpstatus.bad_request('bad request')

    except Exception as e:
        print(e)
        return int_server('server error')
def deldevice(id):
    try:

        status = InventDB.delDevice(id)

        if status == 0:
            return Httpstatus.ok_server_put('ok')

        elif status == 1:

            return Httpstatus.not_found('not found')

        elif status == 2:

            return Httpstatus.int_server('server error')

        else:
            return Httpstatus.conflict('Conflicto al borrar')

    except:
        return Httpstatus.int_server('server error')
Exemple #5
0
def delhistorial(id):
    try:

        status = HistorialDB.delhistorialByID(id)

        if status == 0:
            return Httpstatus.ok_server_put('ok')

        elif status == 1:

            return Httpstatus.not_found('not found')

        elif status == 2:

            return Httpstatus.int_server('server error')

        else:
            return Httpstatus.conflict('Conflicto al borrar')

    except:
        return Httpstatus.int_server('server error')