public ActionResult Edit(DepartmentViewModel dvm) { var dept = new CYBInfracstructure.DataStructure.Entities.Department { DepartmentName = dvm.DepartmentName, Id = dvm.Id, LocationId = dvm.LocationId, IsActive = dvm.IsActive, Date = dvm.Date }; if (TryUpdateModel(dept)) { _department.Edit(dept); _department.SaveChanges(); TempData["Success"] = "Edited Successfully!"; //TempData["Message"] = "Client Details Edited Successfully"; return(RedirectToAction("Index")); } return(View()); }