public ActionResult Delete(PolicyAllOtherGroupItemDataTableItemVM policyAllOtherGroupItemDataTableItemVM) { //Check PolicyAllOtherGroupItemDataTableRow Exists PolicyAllOtherGroupItemDataTableRow policyAllOtherGroupItemDataTableRow = new PolicyAllOtherGroupItemDataTableRow(); policyAllOtherGroupItemDataTableRow = policyAllOtherGroupItemDataTableRowRepository.GetPolicyAllOtherGroupItemDataTableRow( policyAllOtherGroupItemDataTableItemVM.PolicyAllOtherGroupItemDataTableRow.PolicyAllOtherGroupItemDataTableRowId ); if (policyAllOtherGroupItemDataTableRow == null) { ViewData["ActionMethod"] = "DeletePost"; return(View("RecordDoesNotExistError")); } //Check Policy Exists PolicyGroup policyGroup = new PolicyGroup(); policyGroup = policyGroupRepository.GetGroup(policyAllOtherGroupItemDataTableItemVM.PolicyGroup.PolicyGroupId); if (policyGroup == null) { ViewData["ActionMethod"] = "DeletePost"; return(View("RecordDoesNotExistError")); } //Check PolicyOtherGroupHeader Exists PolicyOtherGroupHeader policyOtherGroupHeader = new PolicyOtherGroupHeader(); policyOtherGroupHeader = policyOtherGroupHeaderRepository.GetPolicyOtherGroupHeader( policyAllOtherGroupItemDataTableItemVM.PolicyOtherGroupHeader.PolicyOtherGroupHeaderId ); if (policyOtherGroupHeader == null) { ViewData["ActionMethod"] = "DeletePost"; return(View("RecordDoesNotExistError")); } //Delete Form Item try { policyAllOtherGroupItemDataTableItemRepository.Delete(policyAllOtherGroupItemDataTableRow); } catch (SqlException ex) { //Versioning Error - go to standard versionError page if (ex.Message == "SQLVersioningError") { ViewData["ReturnURL"] = "/PolicyAllOtherGroupItemDataTableItem.mvc/Delete/" + policyAllOtherGroupItemDataTableItemVM.PolicyAllOtherGroupItemDataTableRow.PolicyAllOtherGroupItemDataTableRowId; 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 = policyAllOtherGroupItemDataTableItemVM.PolicyOtherGroupHeader.PolicyOtherGroupHeaderId, policyGroupId = policyAllOtherGroupItemDataTableItemVM.PolicyGroup.PolicyGroupId })); }
//Delete public void Delete(PolicyAllOtherGroupItemDataTableRow policyAllOtherGroupItemDataTableRow) { string adminUserGuid = HttpContext.Current.User.Identity.Name.Split(new[] { '|' })[0]; db.spDesktopDataAdmin_DeletePolicyAllOtherGroupItemDataTableItem_v1( policyAllOtherGroupItemDataTableRow.PolicyAllOtherGroupItemDataTableRowId, adminUserGuid, policyAllOtherGroupItemDataTableRow.VersionNumber ); }
public ActionResult Delete(int id, int policyGroupId, int policyOtherGroupHeaderId) { PolicyAllOtherGroupItemDataTableItemVM policyAllOtherGroupItemDataTableItemVM = new PolicyAllOtherGroupItemDataTableItemVM(); //Check PolicyAllOtherGroupItemDataTableRow Exists PolicyAllOtherGroupItemDataTableRow policyAllOtherGroupItemDataTableRow = new PolicyAllOtherGroupItemDataTableRow(); policyAllOtherGroupItemDataTableRow = policyAllOtherGroupItemDataTableRowRepository.GetPolicyAllOtherGroupItemDataTableRow(id); if (policyAllOtherGroupItemDataTableRow == 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")); } policyAllOtherGroupItemDataTableItemVM.PolicyOtherGroupHeader = policyOtherGroupHeader; policyGroupRepository.EditGroupForDisplay(policyGroup); policyAllOtherGroupItemDataTableItemVM.PolicyGroup = policyGroup; policyAllOtherGroupItemDataTableItemVM.PolicyAllOtherGroupItemDataTableRow = policyAllOtherGroupItemDataTableRow; List <PolicyAllOtherGroupItemDataTableItem> policyAllOtherGroupItemDataTableItems = new List <PolicyAllOtherGroupItemDataTableItem>(); policyAllOtherGroupItemDataTableItems = policyAllOtherGroupItemDataTableRowRepository.GetPolicyAllOtherGroupItemDataTableItems(id, policyOtherGroupHeaderId); if (policyAllOtherGroupItemDataTableItems != null) { policyAllOtherGroupItemDataTableItemVM.PolicyAllOtherGroupItemDataTableItems = policyAllOtherGroupItemDataTableItems; } return(View(policyAllOtherGroupItemDataTableItemVM)); }
public PolicyAllOtherGroupItemDataTableItemVM( PolicyAllOtherGroupItemDataTableRow policyAllOtherGroupItemDataTableRow, PolicyAllOtherGroupItem policyAllOtherGroupItem, PolicyOtherGroupHeader policyOtherGroupHeader, PolicyGroup policyGroup, List <PolicyAllOtherGroupItemDataTableItem> policyAllOtherGroupItemDataTableItems ) { PolicyAllOtherGroupItemDataTableRow = policyAllOtherGroupItemDataTableRow; PolicyAllOtherGroupItem = policyAllOtherGroupItem; PolicyOtherGroupHeader = policyOtherGroupHeader; PolicyGroup = policyGroup; PolicyAllOtherGroupItemDataTableItems = policyAllOtherGroupItemDataTableItems; }