public ActionResult DeleteManager(Guid itemId) { var deleting_manager = _db.Manager.Find(itemId); if (deleting_manager == null) { return(HttpNotFound()); } _db.Manager.Remove(deleting_manager); _db.Entry(deleting_manager).State = EntityState.Deleted; _db.SaveChanges(); return(RedirectToAction("Index")); }
public ActionResult EditEmployee(EmployeeViewModel vm) { try { var mdl_emp = _db.Employee.Find(vm.emp_id); var edit_emp = new EmployeeViewModel(mdl_emp, vm); _db.Entry(mdl_emp).State = EntityState.Modified; _db.SaveChanges(); return(RedirectToAction("Index", "Manager", new { mgr_id = vm.mgr_id })); } catch { return(View()); } }