public IActionResult Get([FromBody] OperationCategoriesGetRequest query) => ReturnBadRequestIfThrowError(() => { var resources = _operationCategoriesService.GetOperationCategories(query, UserId); Response.Headers.Add("X-Pagination", JsonConvert.SerializeObject(resources.PagingData())); return(resources); });
public PagedList<OperationCategoriesResponse> GetOperationCategories(OperationCategoriesGetRequest query, Guid userId) => PagedList<OperationCategoriesResponse>.ToPagedList(_repository.GetAll() .Where(o => o.UserId == userId) .Where(o => o.Name == (query.Name ?? o.Name)) .Select(r => _mapper.Map<OperationCategoriesResponse>(r)), query.Page, query.Limit);