Ejemplo n.º 1
0
        public async Task <IActionResult> GetById(long id)
        {
            var model = await RoleSvc.GetByIdAsync(id);

            if (model == null)
            {
                return(new JsonResult(new APIResult <long> {
                    ErrorMsg = "id不存在"
                })
                {
                    StatusCode = 400
                });
            }
            return(new JsonResult(new APIResult <ListRolePermissionDTO> {
                Data = model
            }));
        }
Ejemplo n.º 2
0
        public async Task <IActionResult> Edit(long id)
        {
            var role = await RoleSvc.GetByIdAsync(id);

            if (role == null)
            {
                return(NotFound());
            }
            var rolePers = await PerSvc.GetByRoleIdAsync(role.Id);

            var pers = await PerSvc.GetAllAsync <List <ListRolePermissionDTO> >();

            RoleListModel model = new RoleListModel();

            model.Role     = role;
            model.RolePers = rolePers;
            model.Pers     = pers;
            return(View(model));
        }