public ActionResult Delete(int id) { using (HELLOWEntities db = new HELLOWEntities()) { tm_Operator emp = db.tm_Operator.Where(x => x.Operator_PK == id).FirstOrDefault <tm_Operator>(); emp.Status_FK = 2; db.SaveChanges(); return(Json(new { success = true, message = "Deleted Successfully" }, JsonRequestBehavior.AllowGet)); } }
public ActionResult AddOrEdit(tm_Operator emp) { using (HELLOWEntities db = new HELLOWEntities()) { if (emp.Operator_PK == 0) { emp.Status_FK = 1; db.tm_Operator.Add(emp); db.SaveChanges(); return(Json(new { success = true, message = "Saved Successfully" }, JsonRequestBehavior.AllowGet)); } else { emp.Status_FK = 1; db.Entry(emp).State = EntityState.Modified; db.SaveChanges(); return(Json(new { success = true, message = "Updated Successfully" }, JsonRequestBehavior.AllowGet)); } } }