public JsonResult Deactivate_Api(TuitionManagement.Models.Object object_obj)
 {
     TuitionManagement.Models.Object object_objEdit = db.Object.Where(b => b.ObjectId == object_obj.ObjectId).FirstOrDefault();
     db.Object.Attach(object_objEdit);
     db.Object.Remove(object_objEdit);
     if (db.SaveChanges() == 1)
     {
         return(Json(1, JsonRequestBehavior.AllowGet));
     }
     else
     {
         return(Json(0, JsonRequestBehavior.AllowGet));
     }
 }
Exemplo n.º 2
0
 public JsonResult Update_Api(TuitionManagement.Models.Object object_obj)
 {
     TuitionManagement.Models.Object object_objEdit = db.Object.Where(b => b.ObjectId == object_obj.ObjectId).FirstOrDefault();
     object_objEdit.ObjectName = object_obj.ObjectName;
     object_objEdit.Class      = object_obj.Class;
     object_objEdit.Notes      = object_obj.Notes;
     if (db.SaveChanges() == 1)
     {
         return(Json(1, JsonRequestBehavior.AllowGet));
     }
     else
     {
         return(Json(0, JsonRequestBehavior.AllowGet));
     }
 }
Exemplo n.º 3
0
 public JsonResult Create_Api(TuitionManagement.Models.Object object_obj)
 {
     try
     {
         db.Object.Add(object_obj);
         if (db.SaveChanges() == 1)
         {
             return(Json(1, JsonRequestBehavior.AllowGet));
         }
         else
         {
             return(Json(0, JsonRequestBehavior.AllowGet));
         }
     }
     catch (Exception e)
     {
         return(Json(e.Message, JsonRequestBehavior.AllowGet));
     }
 }