public ActionResult VolunteerCalendar() { Models.CalendarViewModel model = new Models.CalendarViewModel { NumberOfDays = 7, StartDate = DateTime.Now, DaysInMonth = DateTime.DaysInMonth(DateTime.Now.Year, DateTime.Now.Month), Month = DateTime.Now }; return(View("VolunteerCalendar", model)); }
public ActionResult MySchedule(long id = -1) { if (id != -1) { currentUser = id; } Models.CalendarViewModel model = new Models.CalendarViewModel { NumberOfDays = 7, StartDate = DateTime.Now, DaysInMonth = DateTime.DaysInMonth(DateTime.Now.Year, DateTime.Now.Month), Month = DateTime.Now }; return(View("MySchedule", model)); }
public ActionResult AdminCalendar(string requestedDate, string userMonth, string userYear) { int month = 0; switch (userMonth) { case "January": month = 1; break; case "February": month = 2; break; case "March": month = 3; break; case "April": month = 4; break; case "May": month = 5; break; case "June": month = 6; break; case "July": month = 7; break; case "August": month = 8; break; case "September": month = 9; break; case "October": month = 10; break; case "November": month = 11; break; case "December": month = 12; break; } DateTime newDate = new DateTime(Int32.Parse(userYear), month, DateTime.Now.Day); if (requestedDate == "Back One Month") { newDate = newDate.AddMonths(-1); if (month == 1) { newDate.AddYears(-1); } } else if (requestedDate == "Forward One Month") { newDate = newDate.AddMonths(1); if (month == 12) { newDate.AddYears(1); } } Models.CalendarViewModel model = new Models.CalendarViewModel { NumberOfDays = 7, StartDate = newDate, DaysInMonth = DateTime.DaysInMonth(DateTime.Now.Year, DateTime.Now.Month), Month = newDate }; return(View("AdminCalendar", model)); }