public ActionResult Edit(CategoryVM categoryVM) { string ErrorMessage = string.Empty; Category category = new Category(); //TODO : Mapping category.Id = categoryVM.Id; category.Name = categoryVM.Name; category.IsActive = categoryVM.IsActive; //TODO : Calling Data Layer var IsSuccess = dalCategory.UpdateById(out ErrorMessage, category); if (IsSuccess) { return(RedirectToAction("GetAll")); } else { ErrorMessage = ErrorClass + " | " + ErrorMessage; throw new Exception(ErrorMessage); } }