public ActionResult DeleteConfirmed(ReasonViewModel vm) { if (ModelState.IsValid) { //Commit the DB try { List <LogTypeViewModel> LogList = new List <LogTypeViewModel>(); Dimension1 temp = _Dimension1Service.Find(vm.id); int DocTypeId = (int)temp.DocTypeId; LogList.Add(new LogTypeViewModel { ExObj = Mapper.Map <Dimension1>(temp), }); XElement Modifications = _modificationCheck.CheckChanges(LogList); _Dimension1Service.Delete(vm.id); _logger.LogActivityDetail(logVm.Map(new ActiivtyLogViewModel { DocTypeId = DocTypeId, DocId = temp.Dimension1Id, ActivityType = (int)ActivityTypeContants.Deleted, UserRemark = vm.Reason, DocNo = temp.Dimension1Name, xEModifications = Modifications, DocDate = temp.CreatedDate, })); } catch (Exception ex) { string message = _exception.HandleException(ex); TempData["CSEXC"] += message; return(PartialView("_Reason", vm)); } return(Json(new { success = true })); } return(PartialView("_Reason", vm)); }
public ActionResult DeleteConfirmed(ReasonViewModel vm) { List <LogTypeViewModel> LogList = new List <LogTypeViewModel>(); if (ModelState.IsValid) { var temp = _Dimension1Service.Find(vm.id); LogList.Add(new LogTypeViewModel { ExObj = temp, }); _Dimension1Service.Delete(vm.id); XElement Modifications = new ModificationsCheckService().CheckChanges(LogList); try { _unitOfWork.Save(); } catch (Exception ex) { string message = _exception.HandleException(ex); ModelState.AddModelError("", message); return(PartialView("_Reason", vm)); } LogActivity.LogActivityDetail(LogVm.Map(new ActiivtyLogViewModel { DocTypeId = new DocumentTypeService(_unitOfWork).FindByName(MasterDocTypeConstants.Dimension1).DocumentTypeId, DocId = vm.id, ActivityType = (int)ActivityTypeContants.Deleted, UserRemark = vm.Reason, xEModifications = Modifications, })); return(Json(new { success = true })); } return(PartialView("_Reason", vm)); }