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 })); } }