예제 #1
0
        public async Task <List <AdminPermission> > GetPermissionsAsync([FromBody] GetAdminByIdRequestModel request)
        {
            if (string.IsNullOrWhiteSpace(request?.AdminUserId))
            {
                throw new BadRequestException($"{nameof(request.AdminUserId)} can't be empty");
            }

            var permissions = await _adminUserService.GetPermissionsAsync(request.AdminUserId);

            return(_mapper.Map <List <AdminPermission> >(permissions));
        }
예제 #2
0
        public async Task <AdminUserResponseModel> GetByIdAsync([FromBody] GetAdminByIdRequestModel request)
        {
            if (string.IsNullOrWhiteSpace(request?.AdminUserId))
            {
                throw new BadRequestException($"{nameof(request.AdminUserId)} can't be empty");
            }

            var admin = await _adminUserService.GetByIdAsync(request.AdminUserId);

            return(_mapper.Map <AdminUserResponseModel>(admin));
        }