public PagedResponse <GenderDto> Execute(SearchPropertyName search) { var query = _context.Genders.AsQueryable(); if (!string.IsNullOrEmpty(search.Name) || !string.IsNullOrWhiteSpace(search.Name)) { query = query.Where(x => x.Name.ToLower().Contains(search.Name.ToLower())); } var skipCount = search.PerPage * (search.Page - 1); var response = new PagedResponse <GenderDto> { CurrentPage = search.Page, ItemsPerPage = search.PerPage, TotalCount = query.Count(), Items = _mapper.Map <List <GenderDto> >(query.Skip(skipCount).Take(search.PerPage).ToList()) }; return(response); }
public IActionResult Get([FromQuery] SearchPropertyName search, [FromServices] IShoeTypesGet query) { return(Ok(executor.ExecuteQuery(query, search))); }