Exemplo n.º 1
0
        public ActionResult AddToDates(string start, string end)
        {
            DateTime startDate = Utilities.Constants.GetDateTimeFromFullCalendar(start);
            DateTime endDate   = Utilities.Constants.GetDateTimeFromFullCalendar(end);

            var model = new AddWODToDatesViewModel {
                StartDate = startDate, EndDate = endDate
            };

            return(View(model));
        }
Exemplo n.º 2
0
        public async Task <ActionResult> AddToDates(AddWODToDatesViewModel model)
        {
            List <Class> classes = db.Classes.ToList().Where(c => c.Time.Value.Date >= model.StartDate.Date && c.Time.Value.Date <= model.EndDate.Date).ToList();
            WOD          wod     = await db.WODs.SingleAsync(w => w.Name.Equals(model.WODName));

            foreach (var cls in classes)
            {
                cls.WOD = wod;
            }
            await db.SaveChangesAsync();

            ViewBag.Success = true;
            return(RedirectToAction("Index", new { controller = "Classes" }));
        }