public ActionResult StatisticsSales(string minDate = null, string maxDate = null) { if (!IsAdministrator()) return View("Error"); var report = new Reports(_salesOrderDetail, _salesOrderHeader); ViewBag.Date = report.GetStatisticsBySales().Select(y => y.DateTime).Distinct(); if (minDate != null && maxDate != null) { var result = report.GetStatisticsBySales().Where(x => x.DateTime.CompareTo(Convert.ToDateTime(minDate)) >= 0 && x.DateTime.CompareTo(Convert.ToDateTime(maxDate).AddSeconds(1)) <= 0); return View(result.ToList()); } return View(report.GetStatisticsBySales()); }
public ActionResult StatisticsUser(int userId) { if (!IsAdministrator()) return View("Error"); var report = new Reports(_salesOrderDetail, _salesOrderHeader); TempData["User"] = _userRepository.Users.FirstOrDefault(x => x.CustomerID == userId).LastName; return View(report.GetUserReport(userId)); }
public ActionResult StatisticsProduct(int productId) { if (!IsAdministrator()) return View("Error"); var report = new Reports(_salesOrderDetail, _salesOrderHeader); TempData["Product"] = _repository.Products.FirstOrDefault(x => x.ProductID == productId).Name; return View(report.GetProductReport(productId)); }