public async Task <IHttpActionResult> GetListAsync([FromUri] MatchStatus?status = null, [FromUri] int page = 0, [FromUri] int size = 10) { IMatchRepository repo = UnitOfWork.GetMatchRepository(); SelectOptions <DAL.Models.Match> options = new SelectOptions <DAL.Models.Match> { OrderBy = p => p.OrderByDescending(t => t.Id), Take = size, Skip = page * size }; StatusSpecification specification = new StatusSpecification(status); IEnumerable <DAL.Models.Match> result = await repo.SelectAsync(specification = specification, options : options); int count = await repo.CountAsync(specification : specification); Paging paging = new Paging(count: count, page: page, size: size); GetListResponse response = new GetListResponse(paging) { Items = result.Select(m => new GetListResponseItem { Id = m.Id, StartDt = m.StartDt, Status = m.Status, Guest = new GetListResponseItemTeam { Id = m.GuestId, City = m.Guest.City, Country = m.Guest.County, Goals = m.Goals.Count(g => g.TeamId == m.GuestId), Name = m.Guest.Name, Logotype = m.Guest.Logotype }, Home = new GetListResponseItemTeam { Id = m.HomeId, City = m.Home.City, Country = m.Home.County, Goals = m.Goals.Count(g => g.TeamId == m.HomeId), Name = m.Home.Name, Logotype = m.Home.Logotype } }) }; return(Ok(response)); }