public ActionResult Report(DateTime?from, DateTime?to, string dateType = "week") { 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 periods = _videoRepository.GetAccessDataBetween(from.Value, to.Value); var periodsNotCombine = _videoRepository.GetAccessNotCombineDataBetween(from.Value, to.Value); var catCombines = _videoRepository.GetCatCombineList(from.Value, to.Value); var data = new Dictionary <CatCombineView, List <PeriodVideoAccess> >(); foreach (var catCombine in catCombines) { data.Add(catCombine, _videoRepository.GetCatCombineDataByParentBetween(catCombine, from.Value, to.Value)); } ViewBag.data = data; ViewBag.periodsNotCombine = periodsNotCombine; ViewBag.dateType = dateType; ViewBag.fromDate = from.Value.Date.ToString("dd/MM/yyyy"); ViewBag.toDate = to.Value.Date.ToString("dd/MM/yyyy"); return(View(periods)); }