コード例 #1
0
        public async Task <IActionResult> GetUsers([FromQuery] RequestParams requestParams)
        {
            if (requestParams == null)
            {
                return(BadRequest());
            }

            var response = Enumerable.Empty <User>();

            if (requestParams.Ids != null)
            {
                response = await _userService.GetUsers(requestParams.Ids);
            }
            else
            {
                var users = await _userService.GetUsers(
                    requestParams.Filter,
                    requestParams.PageSize,
                    requestParams.PageNumber);

                response = users.Item1;
                ControllerUtils.AddContentRangeHeader(Request.HttpContext.Response, users.Item2);
            }

            return(Ok(response));
        }