示例#1
0
        public async Task <RoleModel> GetAsync(int roleId)
        {
            if (roleId == 0)
            {
                throw new BadRequestException("Invalid Role Id");
            }

            var model = await _repository.GetAsync(roleId);

            if (model == null)
            {
                throw new NotFoundException("Role not found");
            }

            return(model);
        }
示例#2
0
        public async Task <ActionResult> Details(string id)
        {
            var model = await _rolesRepository.GetAsync(id);

            return(View(model));
        }
示例#3
0
 public async Task <IActionResult> Get()
 {
     return(Ok(await _rolesRepository.GetAsync()));
 }