Beispiel #1
0
        //
        // GET: /Report/

        public ActionResult Index()
        {
            var rep = new ReportModel();

            rep.StartTime = new DateTime(DateTime.Now.Year, DateTime.Now.Month, 1);

            rep.TimeSpan = DateTime.Now - rep.StartTime;

            var orders = db.Orders.Where(o => o.CreateDate.Month == rep.StartTime.Month).ToList();

            rep.OrderCount = orders.Count();

            rep.Sales = orders.Sum(o => o.TotalPrice);

            rep.Count = orders.Sum(o => o.TotalCount);

            rep.DigitalSales = orders.Sum(o => o.TotalDigitalPrice);

            rep.DigitalCount = orders.Sum(o => o.TotalDigitalCount);

            rep.NewAlbum = db.Items.ToList().Where(i => i.IsAlbum && i.AddedDate.Month == rep.StartTime.Month).Count();

            rep.UserCount = orders.Select(o => o.UserData).Distinct().Count();

            rep.TotalPV = db.GetAllPageViewCount();

            return(View(rep));
        }