// GET: SeatBookings public ViewResult Index() { //get the date of last month DateTime LastMonth = DateTime.Today; //todo change this to after today, they don't want to know old bookings. - or last week so they can see what they made comment out next line LastMonth = LastMonth.AddMonths(-1); //return the bookings for that user from that date to today var lastMonthbookings = _context.SeatBooking .Where(s => s.StudentEmail == _userManager.GetUserName(User) && s.SeatDate > LastMonth) .OrderByDescending(s => s.SeatDate) .ToList(); //Get the current user // var user = _userManager.GetUserName(User); //runs the method that generates the calender entries, but we don't want the return only the second line below. var IgnoreThisOutput = _calService.GetBookedSeats(lastMonthbookings, true); ViewData["BookedSessions"] = _dbCallsSessionDataDTO.SeatBookingsOutputToIndex; // _generateCalendarEventsForControllers.GenerateCalendarEventsForSeatBookings(user, lastMonthbookings); //Sessions that are visible or not ViewData["SessionVisible"] = _sessions.GetAdminData(); return(View(lastMonthbookings)); }
// show the timetabling details of which session all students attend // GET: Students public ViewResult Timetable() { //get all entries including today DateTime Yesterday = DateTime.Today.AddDays(-7); var _allBookingsFromYesterday = _context.SeatBooking .Where(s => s.SeatDate > Yesterday).ToList(); //runs the method that generates the calender entries, but we don't want the return only the second line below. var IgnoreThisOutput = _calService.GetBookedSeats(_allBookingsFromYesterday, false); var result = _dbCallsSessionDataDTO.SessionAndNames; //todo pass the result to the emailcontroller / TimeTableEmails so that it can be used when a person clicks on the email. _dbCallsSessionDataDTO.TimeTable = result; return(View(result)); }