public ActionResult Delete(int id) { using (HELLOWEntities db = new HELLOWEntities()) { tm_Recorder emp = db.tm_Recorder.Where(x => x.Recorder_PK == id).FirstOrDefault <tm_Recorder>(); emp.Status_FK = 2; db.SaveChanges(); return(Json(new { success = true, message = "Deleted Successfully" }, JsonRequestBehavior.AllowGet)); } }
public ActionResult AddOrEdit(tm_Recorder emp) { using (HELLOWEntities db = new HELLOWEntities()) { if (emp.Recorder_PK == 0) { emp.Status_FK = 1; db.tm_Recorder.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)); } } }