public ActionResult Grid(string search, int?page) { ViewBag.Search = search; ViewBag.Page = page; var list = _offersProvider.GetOffers(search); int pageSize = 14; int itemsToSkip = (page ?? 0) * pageSize; var elements = list.Skip(itemsToSkip).Take(pageSize).Select(n => new ListItemViewModel() { Company = n.Company.Name, Id = n.Id, Title = n.Title, Type = n.Type.Name }); return(PartialView("Partials/_grid", elements)); }
public JsonResult DataTable(string search) { var list = _offersProvider.GetOffers(search) .Select(offer => new ListItemViewModel() { Title = offer.Title, Id = offer.Id, Company = offer.Company.Name }).ToList(); return(Json(list, JsonRequestBehavior.AllowGet)); }