public ActionResult Delete(PolicyOnlineOtherGroupItemDataTableItemVM PolicyOnlineOtherGroupItemDataTableItemVM) { //Check PolicyOnlineOtherGroupItemDataTableRow Exists PolicyOnlineOtherGroupItemDataTableRow PolicyOnlineOtherGroupItemDataTableRow = new PolicyOnlineOtherGroupItemDataTableRow(); PolicyOnlineOtherGroupItemDataTableRow = PolicyOnlineOtherGroupItemDataTableRowRepository.GetPolicyOnlineOtherGroupItemDataTableRow( PolicyOnlineOtherGroupItemDataTableItemVM.PolicyOnlineOtherGroupItemDataTableRow.PolicyOnlineOtherGroupItemDataTableRowId ); if (PolicyOnlineOtherGroupItemDataTableRow == null) { ViewData["ActionMethod"] = "DeletePost"; return(View("RecordDoesNotExistError")); } //Check Policy Exists PolicyGroup policyGroup = new PolicyGroup(); policyGroup = policyGroupRepository.GetGroup(PolicyOnlineOtherGroupItemDataTableItemVM.PolicyGroup.PolicyGroupId); if (policyGroup == null) { ViewData["ActionMethod"] = "DeletePost"; return(View("RecordDoesNotExistError")); } //Check PolicyOtherGroupHeader Exists PolicyOtherGroupHeader policyOtherGroupHeader = new PolicyOtherGroupHeader(); policyOtherGroupHeader = policyOtherGroupHeaderRepository.GetPolicyOtherGroupHeader( PolicyOnlineOtherGroupItemDataTableItemVM.PolicyOtherGroupHeader.PolicyOtherGroupHeaderId ); if (policyOtherGroupHeader == null) { ViewData["ActionMethod"] = "DeletePost"; return(View("RecordDoesNotExistError")); } //Delete Form Item try { PolicyOnlineOtherGroupItemDataTableItemRepository.Delete(PolicyOnlineOtherGroupItemDataTableRow); } catch (SqlException ex) { //Versioning Error - go to standard versionError page if (ex.Message == "SQLVersioningError") { ViewData["ReturnURL"] = "/PolicyOnlineOtherGroupItemDataTableItem.mvc/Delete/" + PolicyOnlineOtherGroupItemDataTableItemVM.PolicyOnlineOtherGroupItemDataTableRow.PolicyOnlineOtherGroupItemDataTableRowId; return(View("VersionError")); } LogRepository logRepository = new LogRepository(); logRepository.LogError(ex.Message); ViewData["Message"] = "There was a problem with your request, please see the log file or contact an administrator for details"; return(View("Error")); } return(RedirectToAction("List", new { id = PolicyOnlineOtherGroupItemDataTableItemVM.PolicyOtherGroupHeader.PolicyOtherGroupHeaderId, policyGroupId = PolicyOnlineOtherGroupItemDataTableItemVM.PolicyGroup.PolicyGroupId })); }
//Delete public void Delete(PolicyOnlineOtherGroupItemDataTableRow PolicyOnlineOtherGroupItemDataTableRow) { string adminUserGuid = HttpContext.Current.User.Identity.Name.Split(new[] { '|' })[0]; db.spDesktopDataAdmin_DeletePolicyOnlineOtherGroupItemDataTableItem_v1( PolicyOnlineOtherGroupItemDataTableRow.PolicyOnlineOtherGroupItemDataTableRowId, adminUserGuid, PolicyOnlineOtherGroupItemDataTableRow.VersionNumber ); }
public ActionResult Delete(int id, int policyGroupId, int policyOtherGroupHeaderId) { PolicyOnlineOtherGroupItemDataTableItemVM PolicyOnlineOtherGroupItemDataTableItemVM = new PolicyOnlineOtherGroupItemDataTableItemVM(); //Check PolicyOnlineOtherGroupItemDataTableRow Exists PolicyOnlineOtherGroupItemDataTableRow PolicyOnlineOtherGroupItemDataTableRow = new PolicyOnlineOtherGroupItemDataTableRow(); PolicyOnlineOtherGroupItemDataTableRow = PolicyOnlineOtherGroupItemDataTableRowRepository.GetPolicyOnlineOtherGroupItemDataTableRow(id); if (PolicyOnlineOtherGroupItemDataTableRow == null) { ViewData["ActionMethod"] = "EditGet"; return(View("RecordDoesNotExistError")); } //Check Policy Exists PolicyGroup policyGroup = new PolicyGroup(); policyGroup = policyGroupRepository.GetGroup(policyGroupId); if (policyGroup == null) { ViewData["ActionMethod"] = "EditGet"; return(View("RecordDoesNotExistError")); } //Check PolicyOtherGroupHeader Exists PolicyOtherGroupHeader policyOtherGroupHeader = new PolicyOtherGroupHeader(); policyOtherGroupHeader = policyOtherGroupHeaderRepository.GetPolicyOtherGroupHeader(policyOtherGroupHeaderId); if (policyOtherGroupHeader == null) { ViewData["ActionMethod"] = "EditGet"; return(View("RecordDoesNotExistError")); } PolicyOnlineOtherGroupItemDataTableItemVM.PolicyOtherGroupHeader = policyOtherGroupHeader; policyGroupRepository.EditGroupForDisplay(policyGroup); PolicyOnlineOtherGroupItemDataTableItemVM.PolicyGroup = policyGroup; PolicyOnlineOtherGroupItemDataTableItemVM.PolicyOnlineOtherGroupItemDataTableRow = PolicyOnlineOtherGroupItemDataTableRow; List <PolicyOnlineOtherGroupItemDataTableItem> PolicyOnlineOtherGroupItemDataTableItems = new List <PolicyOnlineOtherGroupItemDataTableItem>(); PolicyOnlineOtherGroupItemDataTableItems = PolicyOnlineOtherGroupItemDataTableRowRepository.GetPolicyOnlineOtherGroupItemDataTableItems(id, policyOtherGroupHeaderId); if (PolicyOnlineOtherGroupItemDataTableItems != null) { PolicyOnlineOtherGroupItemDataTableItemVM.PolicyOnlineOtherGroupItemDataTableItems = PolicyOnlineOtherGroupItemDataTableItems; } return(View(PolicyOnlineOtherGroupItemDataTableItemVM)); }
public PolicyOnlineOtherGroupItemDataTableItemVM( PolicyOnlineOtherGroupItemDataTableRow PolicyOnlineOtherGroupItemDataTableRow, PolicyOnlineOtherGroupItem PolicyOnlineOtherGroupItem, PolicyOtherGroupHeader policyOtherGroupHeader, PolicyGroup policyGroup, List <PolicyOnlineOtherGroupItemDataTableItem> PolicyOnlineOtherGroupItemDataTableItems ) { PolicyOnlineOtherGroupItemDataTableRow = PolicyOnlineOtherGroupItemDataTableRow; PolicyOnlineOtherGroupItem = PolicyOnlineOtherGroupItem; PolicyOtherGroupHeader = policyOtherGroupHeader; PolicyGroup = policyGroup; PolicyOnlineOtherGroupItemDataTableItems = PolicyOnlineOtherGroupItemDataTableItems; }