public ActionResult Calendar(AdminCalendarModel model) { if (ModelState.IsValid) { var date = new DateTime(model.Year.Value, model.Month.Value, 1); return(RedirectToAction(nameof(Calendar), new { date })); } return(RedirectToAction(nameof(Calendar))); }
public ActionResult Calendar(DateTime?date) { var model = new AdminCalendarModel(); date = date ?? DateTime.Today; model.FirstDayOfMonth = DateTimeUtility.GetFirstDayOfMonth(date.Value); model.LastDayOfMonth = DateTimeUtility.GetLastDayOfMonth(date.Value); model.Bookings = Database.Instance.GetBookings(model.FirstDayOfMonth, model.LastDayOfMonth).Where(b => b.IsActive).ToList(); return(View(model)); }