ABPCMS.Web/Controllers/UsersController.cs
(完整代码) 1KBusing System;
using System.ComponentModel.DataAnnotations;
using System.Diagnostics;
using System.Linq;
using System.Threading.Tasks;
using System.Web.Mvc;
using Abp.Application.Services;
using Abp.Application.Services.Dto;
using Abp.Dependency;
using Abp.Events.Bus.Exceptions;
using Abp.Events.Bus.Handlers;
using Abp.UI;
using Abp.Web.Mvc.Authorization;
using ABPCMS.Authorization;
using ABPCMS.Authorization.Roles;
using ABPCMS.Users;
using ABPCMS.Web.Models.Users;
using Abp.Authorization;
namespace ABPCMS.Web.Controllers
{
[AbpMvcAuthorize(PermissionNames.Pages_Users)]
public class UsersController : ABPCMSControllerBase
{
private readonly IUserAppService _userAppService;
private readonly RoleManager _roleManager;
public UsersController(IUserAppService userAppService, RoleManager roleManager)
{
_userAppService = userAppService;
_roleManager = roleManager;
}
public async Task<ActionResult> Index()
{
var users = (await _userAppService.GetAll(new PagedResultRequestDto { MaxResultCount = int.MaxValue })).Items; //Paging not implemented yet
var roles = (await _userAppService.GetRoles()).Items;
var model = new UserListViewModel
{
Users = users,
Roles = roles
};
return View(model);
}
[AbpAuthorize(PermissionNames.Pages_UserInfos_Update)]
public async Task<ActionResult> EditUserModal(long userId)
{
var user = await _userAppService.Get(new EntityDto<long>(userId));
var roles = (await _userAppService.GetRoles()).Items;
var model = new EditUserModalViewModel
{
User = user,
Roles = roles
};
return View("_EditUserModal", model);
}
}
}
24 小时内免费解锁 3 个项目,之后 1 积分/个。 规则说明
AI 解读
登录后可用,每次 10 积分,解读结果公开显示在下面。
还没有人解读过这个文件。
