BoldSignA modern eSignature application with affordable pricing. Sign up today for unlimited document usage!
namespace MvcApplication66.Controllers { public class HomeController : Controller { public ActionResult Index() { return View(); } public ActionResult DataSource(DataManager dm) { IEnumerable DataSource = new NorthwindDataContext().OrdersViews.ToList(); DataOperations operation = new DataOperations(); DataResult result = new DataResult(); if (dm.Search != null) DataSource = operation.PerformSearching(DataSource, dm.Search); if (dm.Where != null) DataSource = operation.PerformWhereFilter(DataSource, dm.Where, dm.Where[0].Condition); result.count = DataSource.AsQueryable().Count(); if (dm.Skip != null && dm.Skip != 0)//skiped while rendering checkbox DataSource = operation.PerformSkip(DataSource, dm.Skip); if (dm.Take != null && dm.Take != 0)//skiped while rendering checkbox DataSource = operation.PerformTake(DataSource, dm.Take); result.result = DataSource;//passed the whole dataSource directly for checkbox rendering return Json(result, JsonRequestBehavior.AllowGet); } public class DataResult { public IEnumerable result { get; set; } public int count { get; set; } public IEnumerable aggregate { get; set; } } } |
public IEnumerable aggregate { get; set; }
used ?
namespace MvcApplication66.Controllers { public class HomeController : Controller { public ActionResult Index() { return View(); } public ActionResult DataSource(DataManager dm) { IEnumerable DataSource = new NorthwindDataContext().OrdersViews.ToList(); DataOperations operation = new DataOperations(); DataResult result = new DataResult(); if (dm.Search != null) DataSource = operation.PerformSearching(DataSource, dm.Search); if (dm.Where != null) DataSource = operation.PerformWhereFilter(DataSource, dm.Where, dm.Where[0].Condition); result.count = DataSource.AsQueryable().Count(); if (dm.Skip != null && dm.Skip != 0)//skiped while rendering checkbox DataSource = operation.PerformSkip(DataSource, dm.Skip); if (dm.Take != null && dm.Take != 0)//skiped while rendering checkbox DataSource = operation.PerformTake(DataSource, dm.Take); result.result = DataSource;//passed the whole dataSource directly for checkbox rendering return Json(result, JsonRequestBehavior.AllowGet); } public class DataResult { public IEnumerable result { get; set; } public int count { get; set; } } } |
public ActionResult DataSource(DataManager dm) { IEnumerable result = null; int count = 0; IEnumerable DataSource = new NorthwindDataContext().OrdersViews.ToList(); DataOperations operation = new DataOperations(); if (dm.Search != null) DataSource = operation.PerformSearching(DataSource, dm.Search); if (dm.Where != null) DataSource = operation.PerformWhereFilter(DataSource, dm.Where, dm.Where[0].Condition); count = DataSource.AsQueryable().Count(); if (dm.Skip != null && dm.Skip != 0)//skiped while rendering checkbox DataSource = operation.PerformSkip(DataSource, dm.Skip); if (dm.Take != null && dm.Take != 0)//skiped while rendering checkbox DataSource = operation.PerformTake(DataSource, dm.Take); result = DataSource;//passed the whole dataSource directly for checkbox rendering return Json(new { result = result, count = count }, JsonRequestBehavior.AllowGet); //result and count pair defined in a new obj instead of using DataResult Class |