public ActionResult DeletePost(ReportLine pt) { List <LogTypeViewModel> LogList = new List <LogTypeViewModel>(); LogList.Add(new LogTypeViewModel { ExObj = pt, }); _ReportLineService.Delete(pt); XElement Modifications = new ModificationsCheckService().CheckChanges(LogList); try { _unitOfWork.Save(); } catch (Exception ex) { string message = _exception.HandleException(ex); ModelState.AddModelError("", message); return(View("_Create", pt)); } LogActivity.LogActivityDetail(LogVm.Map(new ActiivtyLogViewModel { DocTypeId = new DocumentTypeService(_unitOfWork).Find(TransactionDoctypeConstants.Report).DocumentTypeId, DocId = pt.ReportHeaderId, DocLineId = pt.ReportLineId, ActivityType = (int)ActivityTypeContants.Deleted, xEModifications = Modifications, })); return(Json(new { success = true })); }
public ActionResult DeletePost(ReportLineViewModel pt) { try { _ReportLineService.Delete(pt, User.Identity.Name); } catch (Exception ex) { string message = _exception.HandleException(ex); ModelState.AddModelError("", message); return(View("_Create", pt)); } return(Json(new { success = true })); }
public void Delete(ReasonViewModel vm, string UserName) { List <LogTypeViewModel> LogList = new List <LogTypeViewModel>(); var temp = Find(vm.id); LogList.Add(new LogTypeViewModel { ExObj = temp, }); var line = _reportLineService.GetReportLineList(vm.id).ToList(); foreach (var item in line) { LogList.Add(new LogTypeViewModel { ExObj = item, }); _reportLineService.Delete(item.ReportLineId); } Delete(temp); XElement Modifications = _modificationCheck.CheckChanges(LogList); _unitOfWork.Save(); _logger.LogActivityDetail(LogVm.Map(new ActiivtyLogViewModel { DocTypeId = _DocumentTypeService.FindByName(TransactionDoctypeConstants.Report).DocumentTypeId, DocId = temp.ReportHeaderId, ActivityType = (int)ActivityTypeContants.Deleted, UserRemark = vm.Reason, xEModifications = Modifications, })); }