public List <OrderDto> GetOrdersByPage(GetOrdersByPageDto dto) { return(ctx.Orders. Skip((dto.PageNo - 1) * AdminSettings.Block). Take(AdminSettings.Block). Include(p => p.Party).ThenInclude(p => p.User). Where(p => (dto.UserId == null || p.Party.UserId == dto.UserId) && (dto.PartyId == null || p.PartyId == dto.PartyId)). Include(p => p.Party).ThenInclude(p => p.StoreCategories).ThenInclude(p => p.StoreCategory). Include(p => p.Party).ThenInclude(p => p.StoreImages).ThenInclude(p => p.Document). Include(p => p.InvoiceImages).ThenInclude(p => p.Document). Select(p => DtoBuilder.CreateOrderDto(p)). ToList()); }