public ActionResult Group(GroupSelectDay inputModel) { if (inputModel == null) return RedirectToAction("Index"); if (inputModel.groupId == null) return RedirectToAction("Index"); GroupViewModel model = new GroupViewModel(); model.Calendars = _service.GetGroupUsersCalendars(inputModel.groupId); foreach (var cal in model.Calendars) { model.Calendars[model.Calendars.IndexOf(cal)].Events = _service.GetEventsForDate(cal.Events, inputModel.SelectedDay); } model.GroupCalendar = _service.GetCalendar(inputModel.groupId); model.Group = inputModel.groupId; model.SelectedDay = inputModel.SelectedDay; return View(model); }
public ActionResult Group(string groupId) { if (groupId == null) return RedirectToAction("Index"); GroupViewModel model = new GroupViewModel(); model.Calendars = _service.GetGroupUsersCalendars(groupId); foreach (var cal in model.Calendars) { model.Calendars[model.Calendars.IndexOf(cal)].Events = _service.GetEventsForDate(cal.Events, DateTime.Today); } model.GroupCalendar = _service.GetCalendar(groupId); model.Group = groupId; model.SelectedDay = DateTime.Today; return View(model); }