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)); }
public ActionResult BookingOverview(DateTime?date) { var model = new AdminBookingOverviewModel(); 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); return(View(model)); }
public void FirstDayOfMonthTest() { var first = DateTimeUtility.GetFirstDayOfMonth(new DateTime(2017, 4, 5)); Assert.IsTrue(first.DayOfWeek == DayOfWeek.Saturday); Assert.IsTrue(first.Year == 2017); Assert.IsTrue(first.Month == 4); Assert.IsTrue(first.Day == 1); Assert.IsTrue(first.Hour == 0); Assert.IsTrue(first.Minute == 0); Assert.IsTrue(first.Second == 0); }