// GET: BackendSite/Dashboard public ActionResult Index() { var model = new DashboardViewModel(); var dateOfMonth = GetFirstLastDayOfMonth(); var orders = Context.GetOrders(i => i.OrderedDate >= dateOfMonth[0] && i.OrderedDate <= dateOfMonth[1]); model.MonthOrders = orders.Select(i => new OrderModel(i)).ToList(); return View(model); }
public JsonResult GetOrderCountInMonth() { var model = new DashboardViewModel(); var dateOfMonth = GetFirstLastDayOfMonth(); var orders = Context.GetOrders(i => i.OrderedDate >= dateOfMonth[0] && i.OrderedDate <= dateOfMonth[1]); return Json(new { toConfirmOrder = orders.Count(i => i.Status == null), todayDeliveryOrder = orders.Count(i => i.ShipmentDate >= DateTime.Today && i.ShipmentDate < DateTime.Today.AddDays(1)), upcomingOrder = orders.Count(i => i.ShipmentDate >= DateTime.Today.AddDays(1)), totalOrder = orders.Count() }, JsonRequestBehavior.AllowGet); }