public ActionResult Index() { var model = new GroupSearchViewModel(); return View(model); }
public ActionResult getall(GroupSearchViewModel model, int page = 1, int rows = 10) { var query = GroupService.GetALL(); if (!string.IsNullOrEmpty(model.Group_SearchName)) { query = query.Where(x => x.Name.Contains(model.Group_SearchName)); } var count = query.Count(); var data = query.Select(x => new GroupListViewModel() { ID = x.ID, Name = x.Name, Description = x.Description, Content = x.Content, }) .OrderBy(x => x.ID) .Skip((page - 1) * rows) .Take(rows).ToList(); var obj = new { rows = data, total = count }; return Json(obj); }