public ActionResult VideoCatReportByType(DateTime?from, DateTime?to, string dateType) { DateTime d = DateTime.Today; //Mặc định tuần if (!from.HasValue || !to.HasValue) { int offset = d.DayOfWeek - DayOfWeek.Monday; DateTime monday = d.AddDays(-offset); from = monday; to = monday.AddDays(6); dateType = "week"; } var catTypes = _videoRepository.CatTypeList(); var data = new Dictionary <VideoCatType, List <PeriodVideoAccess> >(); foreach (var catType in catTypes) { data.Add(catType, _videoRepository.GetCatAccessDataByTypeBetween(catType.Id, from.Value, to.Value)); } ViewBag.dateType = dateType; ViewBag.fromDate = from.Value.Date.ToString("dd/MM/yyyy"); ViewBag.toDate = to.Value.Date.ToString("dd/MM/yyyy"); return(View(data)); }