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 })); } }
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 })); } }
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)); } } }
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)); } } }