Example #1
0
 public ActionResult DeleteAddress(string addCode)
 {
     using (db)
     {
         var add = db.Addresses.Find(addCode);
         db.Entry(add).Property(x => x.Status).CurrentValue = false;
         db.SaveChanges();
         return(Json(new { success = true, message = "Deleted successfully.", JsonRequestBehavior.AllowGet }));
     }
 }
Example #2
0
 public ActionResult DeleteData(int staffID)
 {
     using (DatabasModel db = new DatabasModel())
     {
         var staf = db.Staffs.Where(x => x.Staff_ID == staffID).FirstOrDefault <Staff>();
         db.Entry(staf).Property(x => x.Status).CurrentValue = false;
         db.SaveChanges();
         return(Json(new { success = true, message = "Deleted successfully.", JsonRequestBehavior.AllowGet }));
     }
 }
Example #3
0
 public ActionResult AddStaffExtension(Staff_Extensions stfExt)
 {
     using (DatabasModel db = new DatabasModel())
     {
         if (stfExt.Extension_ID == 0)
         {
             db.Staff_Extensions.Add(stfExt);
             db.SaveChanges();
             return(Json(new { success = true, message = "Extension is added" }, JsonRequestBehavior.AllowGet));
         }
         else
         {
             db.Entry(stfExt).State = EntityState.Modified;
             db.SaveChanges();
             return(Json(new { success = true, message = "Updated extension." }, JsonRequestBehavior.AllowGet));
         }
     }
 }
Example #4
0
 public ActionResult StaffRegister(Staff stf)
 {
     using (DatabasModel db = new DatabasModel())
     {
         if (stf.Staff_ID == 0)
         {
             stf.Status = true;
             db.Staffs.Add(stf);
             db.SaveChanges();
             return(Json(new { success = true, message = "Staff is registered.", JsonRequestBehavior.AllowGet }));
         }
         else
         {
             stf.Status          = true;
             db.Entry(stf).State = EntityState.Modified;
             db.SaveChanges();
             return(Json(new { success = true, message = "Updated successfully" }, JsonRequestBehavior.AllowGet));
         }
     }
 }