I have a very simple webapi that returns the wrong amount of data, the API is so simple I simply don't see how this can happen, the controller code is below:
[HttpGet("{TillID}")]
public IEnumerable<object> Get(int tillID, int StartAtRow=0, int TakeNoOfRows=1000)
{
string hmCompanyId;
string languageName;
PrepareParameter(tillID, out hmCompanyId, out languageName);
var tillData = from tbd in _context.TillBasicData.OrderBy(i => i.ItemId).Skip(StartAtRow).Take(TakeNoOfRows)
where tbd.CompanyId == hmCompanyId && tbd.languageCode == languageName
select tbd;
return tillData.ToList();
}
if I use the following URL to call the API I would expect 10 rows of data but I only get 3
https://host.domain.zzz:5443/api/till/tilldata/1?StartAtRow=1&TakeNoOfRows=10
Similar if I use the following URL I would expect 20 rows but I get 5
https://host.domain.zzz:5443/api/till/tilldata/1?StartAtRow=1&TakeNoOfRows=20
Manually querying the DB shows the data in the DB is correct.
Why do I not get the correct amount of rows returned?
EDIT, the following SQL code returns 351443 with the same matching where clause as the actual where clause in the controller
select count(*) from tillbasicdata where CompanyId = 'BE_HM' and languageCode = 'eng'
EDIT, The server log shows the query being executed looks ok, the variables have to be correct because if I increase rows to take to 100 I get more than 10 which should be returned in URL 1