public async Task <IActionResult> DisassociateAction(string id, string permissionId) { ApplicationAction_ApplicationPermission actionPermission = await _context.ApplicationAction_ApplicationPermission.Include(i => i.ApplicationAction).Where(a => a.ApplicationActionId == id && a.ApplicationPermissionId == permissionId).FirstOrDefaultAsync(); if (actionPermission == null) { return(NotFound()); } return(PartialView("_DisassociateAction", actionPermission)); }
public async Task <IActionResult> DisassociateActionConfirmed(string id) { ApplicationAction_ApplicationPermission actionPermission = new ApplicationAction_ApplicationPermission(); string permissionId = string.Empty; try { actionPermission = await _context.ApplicationAction_ApplicationPermission.Where(a => a.Id == id).SingleOrDefaultAsync(); permissionId = actionPermission.ApplicationPermissionId; _context.ApplicationAction_ApplicationPermission.Remove(actionPermission); await _context.SaveChangesAsync(); return(PartialView("_BootstrapModalAction", ActionPermissionModalAction(permissionId))); } catch (Exception ex) { ModelState.AddModelError(string.Empty, $"Error deleting record: {ex.Message}."); } return(PartialView("_DisassociateAction", actionPermission)); }