// GET: ProgramScheduleDetails/Create
        public ActionResult Create(DateTime?date)
        {
            if (!date.HasValue)
            {
                return(new HttpStatusCodeResult(HttpStatusCode.BadRequest));
            }
            ViewBag.VideoCategories = _videoCategoryRepository.GetMany(cat => cat.Children.Count == 0, cat => cat.Name);
            //Lấy thông tin từ khung chương trình
            var dayOfWeek = date.Value.DayOfWeek;

            var detailList = _scheduleRepository.GetMany(s => s.DayOfWeek == dayOfWeek, s => s.Time)
                             .Select(s => new ProgramScheduleDetail
            {
                VideoCategoryId = s.VideoCategoryId,
                DateTime        = date.Value.Date.Add(s.Time),
                VideoCategory   = s.VideoCategory,
                IsNew           = s.IsNew
            }).ToList();

            var model = new DowScheduleDetailModel()
            {
                Date    = date.Value,
                Details = detailList
            };

            return(View(model));
        }
 public ActionResult Create(DowScheduleDetailModel model)
 {
     foreach (var programScheduleDetail in model.Details)
     {
         programScheduleDetail.DateTime = model.Date.Date.Add(programScheduleDetail.DateTime.TimeOfDay);
         _scheduleDetailRepository.InsertOrUpdate(programScheduleDetail);
     }
     _scheduleDetailRepository.Save();
     return(RedirectToAction("Management", new { date = model.Date.ToShortDateString() }));
 }