public async Task <IActionResult> SetRoleMenu(RoleMenu_R roleMenu) { // var tmpData = _EFCoreService.GetRoleMenuByRoleId(roleMenu.RoleId); var tmpData = await _roleMenuService.GetRoleMenusByRoleId(roleMenu.RoleId); if (tmpData != null) { tmpData.SetTime = DateTime.Now; tmpData.MenuInfoId = roleMenu.MenuInfoId; var res = await _roleMenuService.Update(tmpData); return(new JsonResult(new Result { Data = res, Msg = $"设置{(res ? "成功" : "失败")}", Status = res ? 200 : 204 })); } else { roleMenu.RoleMenuId = Guid.NewGuid().ToString(); roleMenu.SetTime = DateTime.Now; //var res = _EFCoreService.SetRoleMenu(roleMenu); var res = await _roleMenuService.Add(roleMenu); return(new JsonResult(new Result { Data = res, Msg = $"设置{(res ? "成功" : "失败")}", Status = res ? 200 : 204 })); } }
public bool UpdateRoleMenu(RoleMenu_R roleMenu) { _myContext.RoleMenu_Rs.Update(roleMenu); return(_myContext.SaveChanges() > 0); }
public bool SetRoleMenu(RoleMenu_R roleMenu) { _myContext.RoleMenu_Rs.Add(roleMenu); return(_myContext.SaveChanges() > 0); }