public bool Create(RoleMenu obj) { bool isSuccess = false; try { isSuccess = true; _RoleMenuRepository.Add(obj); Save(); } catch (Exception ex) { isSuccess = false; throw ex; } return(isSuccess); }
public IActionResult SetMenuPermissions([FromBody] SetMenuPermissionVModel model) { var result = new ResultModel(); return(this.Wrapper(ref result, () => { _roleMenuRepository.DeleteByRoleId(model.roleId); var roleMenus = new List <RoleMenu>(); model.menuIds?.ForEach(ea => { roleMenus.Add(new RoleMenu() { RoleId = model.roleId, MenuId = ea }); }); if (roleMenus?.Any() ?? false) { _roleMenuRepository.Add(roleMenus); } }, true)); }