Example #1
0
        public ActionResult Index()
        {
            var Order  = OrdersDetails.GetAllRecords();
            var Order1 = OrdersData.GetAllRecords();

            ViewBag.DataSource  = BigData.GetAllRecords();
            ViewBag.DataSource1 = Order;
            ViewBag.DataSource2 = OrdersData.GetAllRecords();
            ViewBag.DataSource3 = from a in Order
                                  join b in Order1 on a.EmployeeID equals b.EmployeeID
                                  select new { a.CustomerID, a.EmployeeID, a.OrderDate, a.OrderID, b.ShipName,
                                               b.ShipAddress };

            return(View());
        }
        public IActionResult UrlDatasource([FromBody] DataManagerRequest dm)
        {
            var         Order      = OrdersDetails.GetAllRecords();
            var         Order1     = OrdersData.GetAllRecords();
            IEnumerable DataSource = (from a in Order
                                      join b in Order1 on a.EmployeeID equals b.EmployeeID
                                      select new
            {
                a.CustomerID,
                a.EmployeeID,
                a.OrderDate,
                a.OrderID,
                b.ShipName,
                b.ShipAddress
            }).ToList();
            //IEnumerable DataSource = OrdersDetails.GetAllRecords();
            DataOperations operation = new DataOperations();

            if (dm.Search != null && dm.Search.Count > 0)
            {
                DataSource = operation.PerformSearching(DataSource, dm.Search); //Search
            }
            if (dm.Sorted != null && dm.Sorted.Count > 0)                       //Sorting
            {
                DataSource = operation.PerformSorting(DataSource, dm.Sorted);
            }
            if (dm.Where != null && dm.Where.Count > 0) //Filtering
            {
                DataSource = operation.PerformFiltering(DataSource, dm.Where, dm.Where[0].Operator);
            }
            var MergeListData = DataSource.Cast <object>().ToList();
            int count         = MergeListData.Count();

            if (dm.Skip != 0)
            {
                DataSource = operation.PerformSkip(DataSource, dm.Skip);   //Paging
            }
            if (dm.Take != 0)
            {
                DataSource = operation.PerformTake(DataSource, dm.Take);
            }
            return(dm.RequiresCounts ? Json(new { result = DataSource, count = count }) : Json(DataSource));
        }