0

I have a problem about Skip-Take. Below you can find my code block. Normally, I have 9 items. When I try to use Skip-Take and I want to take 4 items on every pages, the result returns like this: page index=1 item count=3, page index=2 item count=2, page index=3 item count=2

Thanks for your answers.

var DoktorAdlari = (from i in RandevuEslesmeEntity.Query()            
    join dktr in DoktorTanimEntity.Query() on i.KaynakId equals dktr.Id            
    join prsnl in PersonelEntity.Query() on dktr.PersonelId equals prsnl.Id            
    where i.Silindi == false
    select new{ doktor = prsnl.Adi})
    .ToList()
    .Skip(4 * (model.Page.Value-1))
    .Take(4)
    .GroupBy(p => new { p.id, p.doktor })
    .ToList();
Jon Skeet
  • 1,421,763
  • 867
  • 9,128
  • 9,194
Johnny
  • 459
  • 1
  • 4
  • 12
  • 4
    Why are you grouping *after* pagination? Basically you've got a page of results, and then you're grouping - so if there are multiple results in the same group, you won't have as many items as you expected. – Jon Skeet Jul 20 '15 at 15:03
  • 1
    Aren't you doing a GroupBy after you've taken 4? – Steve Ford Jul 20 '15 at 15:06
  • I didn't realized that for hours. Thank you so much for your useful answers. – Johnny Jul 20 '15 at 15:16

0 Answers0