Example #1
0
 def put(self, person_id):
     person = Person.query.filter_by(id=person_id).first()
     data = request.get_json()
     person.name = data["name"]
     person.email = data["email"]
     person.age = data["age"]
     db.session.commit()
     return make_json(person), 201
Example #2
0
 def put(self, person_id):
     person = Person.query.filter_by(id=person_id).first()
     data = request.get_json()
     person.name = data['name']
     person.email = data['email']
     person.age = data['age']
     db.session.commit()
     return make_json(person), 201
Example #3
0
    def post(self):
        data = request.get_json()
        name = data["name"]
        email = data["email"]
        age = data["age"]

        person = Person(name, email, age)
        db.session.add(person)
        db.session.commit()
        return make_json(person)
Example #4
0
    def post(self):
        data = request.get_json()
        name = data["name"]
        email = data["email"]
        age = data["age"]

        person = Person(name, email, age)
        db.session.add(person)
        db.session.commit()
        return make_json(person)
Example #5
0
 def get(self, person_id):
     person = Person.query.filter_by(id=person_id).first()
     return make_json(person)
Example #6
0
 def get(self):
     return make_json(Person.query.all())
Example #7
0
 def get(self, person_id):
     person = Person.query.filter_by(id=person_id).first()
     return make_json(person)
Example #8
0
 def get(self):
     return make_json(Person.query.all())