コード例 #1
0
        public async Task <IActionResult> Index(int?year, string month)

        {
            if (year != null && year >= 2015 && year <= DateTime.Now.Year + 1)
            {
                _year = (int)year;
            }
            else
            {
                _year = DateTime.Now.Year;
            }

            _month = !string.IsNullOrEmpty(month) ? DateTime.ParseExact(month, "MMMM", CultureInfo.CurrentCulture).Month : DateTime.Now.Month;

            IEnumerable <Schedule> scheduleList = await _scheduleRepository.GetScheduleListAsync(_year, _month);

            ScheduleViewModel scheduleViewModel = new ScheduleViewModel
            {
                DirectorSchedule = scheduleList,
                Year             = _year,
                Month            = _month
            };

            var directorList = await _directorRepository.GetAllItemsAsync();

            scheduleViewModel.Directors = directorList.OrderBy(n => n.Alias);

            return(View(scheduleViewModel));
        }