コード例 #1
0
        public IActionResult Index()
        {
            var userId = HttpContext.Session.GetString("SessionId");

            int today = DateTime.Now.Day;
            int week  = DateTime.Now.DayOfYear / 7;
            int month = DateTime.Now.Month;
            int year  = DateTime.Now.Year;

            ViewBag.CountRecordByToday = recordOperations.GetAll().Where(x => x.CreatedDay == today && x.CreatedWeek == week && x.CreatedMonth == month && x.CreatedYear == year).Count();
            ViewBag.CountRecordByWeek  = recordOperations.GetAll().Where(x => x.CreatedWeek == week && x.CreatedMonth == month && x.CreatedYear == year).Count();
            ViewBag.CountRecordByMonth = recordOperations.GetAll().Where(x => x.CreatedMonth == month && x.CreatedYear == year).Count();
            ViewBag.CountRecordsAll    = recordOperations.GetAll().Count;

            ViewBag.CountRecordByFacebook  = recordOperations.GetAll().Where(x => x.MediaName == "Facebook").Count();
            ViewBag.CountRecordByInstagram = recordOperations.GetAll().Where(x => x.MediaName == "Instagram").Count();
            ViewBag.CountRecordByTwitter   = recordOperations.GetAll().Where(x => x.MediaName == "Twitter").Count();

            return(View());
        }