public ActionResult GetRefs(ReferenceFilterViewModel model) { model.InitSortingData(); var list = GetRefsList(model); var source = list.Select(x => new { Name = x.Name, Alias = x.Alias, Key = x.Key, Value = x.Value, Id = x.Id }); return(Json(new { data = source, draw = model.draw, recordsTotal = model.CountTotal, recordsFiltered = model.CountTotal }, JsonRequestBehavior.AllowGet)); }
private List <ApplicationReferences> GetRefsList(ReferenceFilterViewModel model) { List <ApplicationReferences> entity = null; var result = refService.GetAll.Where(x => !x.IsDelete); result = result.OrderBy(model.FieldOrderBy + (model.IsAscending ? " ASC" : " DESC")); model.CountTotal = result.Count(); entity = result.Skip(model.CountOnPage * (model.NumPage - 1)).Take(model.CountOnPage).ToList(); return(entity); }