public AjaxListResult GetItems(PageParentInput input) { const int PageSize = 5; input.Parent = (input.Parent ?? "").ToLower(); var list = Db.Meals.Where(o => o.Name.ToLower().Contains(input.Parent)); return new AjaxListResult { Items = list.Skip((input.Page - 1) * PageSize).Take(PageSize).Select(o => new KeyContent(o.Id, o.Name)), More = list.Count() > input.Page * PageSize // bool - show More button or not }; }
public AjaxListResult GetItems(PageParentInput input) { const int PageSize = 5; input.Parent = (input.Parent ?? "").ToLower(); var list = Db.Meals.Where(o => o.Name.ToLower().Contains(input.Parent)); return(new AjaxListResult { Items = list.Skip((input.Page - 1) * PageSize).Take(PageSize).Select(o => new KeyContent(o.Id, o.Name)), More = list.Count() > input.Page * PageSize // bool - show More button or not }); }