def create():
    if not request.json:
        abort(400)

    book = {
        "title": request.json['title'],
        "author": request.json['author'],
        "price": request.json['price'],
    }
    values = (book['title'], book['author'], book['price'])
    newId = bookDAO.create(values)
    book['id'] = newId
    return jsonify(book)
Exemplo n.º 2
0
def create():
    
    if not request.json:
        abort(400)
    # other checking 
    book = {
        "Title": request.json['Title'],
        "Author": request.json['Author'],
        "Price": request.json['Price'],
    }
    values =(book['Title'],book['Author'],book['Price'])
    newId = bookDAO.create(values)
    book['id'] = newId
    return jsonify(book)
Exemplo n.º 3
0
def create():

    if not request.json:
        abort(400)
    # Other checking - that it is properly formatted etc
    book = {
        "Title": request.json['Title'],
        "Author": request.json['Author'],
        "Price": request.json['Price']
    }
    values = (book['Title'], book['Author'],book['Price'])
    newId =  bookDAO.create(values)
    book['id']= newId
    return jsonify(book)
Exemplo n.º 4
0
def create():
    #global nextId
    if not request.json:
        abort(400)
    # other checking
    book = {
        #"id": nextId,
        "Title": request.json['Title'],
        "Author": request.json['Author'],
        "Price": request.json['Price'],
        "Sex": request.json['Sex'],
    }
    #nextId += 1
    #books.append(book)
    values = (book['Title'], book['Author'], book['Price'], book['Sex'])
    newId = bookDAO.create(values)
    book['id'] = newId
    return jsonify(book)