public ActionResult CourseMeetings(int id) { var utcOffset = TimeDateServices.GetUtcOffSet(); ViewBag.CohortId = id; var course = _context.Courses.Include(c => c.CourseTemplate).FirstOrDefault(c => c.Id == id); if (course != null) ViewBag.Title = "Meetings of Class: " + " " + course.CourseTemplate.Title; var cohortMeetings = _context.Meetings.Where(m => m.CourseId == id).OrderByDescending(m => m.Start).ToList(); var meetingDtos = cohortMeetings.Select(meeting => new MeetingViewModel { Id = meeting.Id, Title = meeting.Title, Start = DateTime.SpecifyKind(meeting.Start, DateTimeKind.Utc).AddMinutes(utcOffset), End = DateTime.SpecifyKind(meeting.End, DateTimeKind.Utc).AddMinutes(utcOffset), Description = meeting.Description, IsAllDay = meeting.IsAllDay, RecurrenceRule = meeting.RecurrenceRule, RecurrenceException = meeting.RecurrenceException, RecurrenceId = meeting.RecurrenceId, CourseId = meeting.CourseId, GtmUrl = meeting.GtmUrl }).ToList(); var viewModel = new MeetingDtosViewModel { MeetingDtos = meetingDtos }; return View(viewModel); }
public ActionResult AllMeetings() { var utcOffset = TimeDateServices.GetUtcOffSet(); ViewBag.Title = "All Meetings "; var cohortMeetings = _context.Meetings.OrderByDescending(m => m.Start).ToList(); var meetingDtos = cohortMeetings.Select(meeting => new MeetingViewModel { Id = meeting.Id, Title = meeting.Title, Start = DateTime.SpecifyKind(meeting.Start, DateTimeKind.Utc).AddMinutes(utcOffset), End = DateTime.SpecifyKind(meeting.End, DateTimeKind.Utc).AddMinutes(utcOffset), Description = meeting.Description, IsAllDay = meeting.IsAllDay, RecurrenceRule = meeting.RecurrenceRule, RecurrenceException = meeting.RecurrenceException, RecurrenceId = meeting.RecurrenceId, CourseId = meeting.CourseId, GtmUrl = meeting.GtmUrl }).ToList(); var viewModel = new MeetingDtosViewModel { MeetingDtos = meetingDtos }; return View(viewModel); }