Exemplo n.º 1
0
        public IActionResult ShowCalendar(int year, int month)
        {
            CalendarViewModel toShow = new CalendarViewModel();

            toShow.Year                = year;
            toShow.Month               = month;
            toShow.StartingDay         = ((int)new DateTime(year, month, 1).DayOfWeek + 6) % 7; // 0-monday, not sunday
            toShow.NumberOfDays        = DateTime.DaysInMonth(year, month);
            toShow.MonthName           = new CultureInfo("en-US").DateTimeFormat.MonthNames[month - 1];
            toShow.DaysOfTheMonthArray = toShow.GetArrayOfDays();
            toShow.Events              = Database.CreateEventsDatabase(year, month);
            return(View(toShow));
        }