Beispiel #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
Beispiel #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
Beispiel #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)
Beispiel #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)
Beispiel #5
0
 def get(self, person_id):
     person = Person.query.filter_by(id=person_id).first()
     return make_json(person)
Beispiel #6
0
 def get(self):
     return make_json(Person.query.all())
Beispiel #7
0
 def get(self, person_id):
     person = Person.query.filter_by(id=person_id).first()
     return make_json(person)
Beispiel #8
0
 def get(self):
     return make_json(Person.query.all())