示例#1
0
 def get(self, request, params={}):
     service = StudentService()
     c = service.get(params["id"])
     res = {}
     if (c != None):
         res["data"] = c.to_json()
         res["error"] = False
         res["message"] = "Data is found"
     else:
         res["error"] = True
         res["message"] = "record not found"
     return JsonResponse({"data": res["data"]})
示例#2
0
 def delete(self, request, params={}):
     service = StudentService()
     c = service.get(params["id"])
     res = {}
     if (c != None):
         service.delete(params["id"])
         res["data"] = c.to_json()
         res["error"] = False
         res["message"] = "Data is Successfully deleted"
     else:
         res["error"] = True
         res["message"] = "Data is not deleted"
     return JsonResponse({"data": res["data"]})