protected void setViewModels() { ViewModels[0] = new NorthWestViewModel(this, Mvx.IoCProvider.Resolve <IMvxNavigationService>()); ViewModels[1] = new NorthViewModel(this, Mvx.IoCProvider.Resolve <IMvxNavigationService>()); ViewModels[2] = new NorthEastViewModel(this, Mvx.IoCProvider.Resolve <IMvxNavigationService>()); ViewModels[3] = new WestViewModel(this, Mvx.IoCProvider.Resolve <IMvxNavigationService>()); ViewModels[4] = new CentralViewModel(this, Mvx.IoCProvider.Resolve <IMvxNavigationService>()); ViewModels[5] = new EastViewModel(this, Mvx.IoCProvider.Resolve <IMvxNavigationService>()); ViewModels[6] = new SouthWestViewModel(this, Mvx.IoCProvider.Resolve <IMvxNavigationService>()); ViewModels[7] = new SouthViewModel(this, Mvx.IoCProvider.Resolve <IMvxNavigationService>()); ViewModels[8] = new SouthEastViewModel(this, Mvx.IoCProvider.Resolve <IMvxNavigationService>()); ViewModels[9] = new ExceptionalViewModel(this, Mvx.IoCProvider.Resolve <IMvxNavigationService>()); }
public ActionResult Exceptional(string session) { var evm = new ExceptionalViewModel(); if (session.IsNullOrWhiteSpace()) { return(View(evm)); } var years = session.Split('-'); if (!years.Any()) { return(View(evm)); } try { var sYear = Convert.ToInt32(years[0]); evm.SYear = sYear; var coursesNoManagers = _db.Courses.Where( c => !c.CourseAssignments.Any(ca => ca.Start.Year == sYear) || c.CourseAssignments.Any(ca => ca.Start.Year == sYear && ca.Managers.Count < 2)) .ToList(); var coursesNoCmr = _db.Courses.Where( c => !c.CourseAssignments.Any(ca => ca.Start.Year == sYear) || c.CourseAssignments.Any(ca => ca.Start.Year == sYear && ca.Reports.Count == 0)) .ToList(); var notApprovedReports = _db.Reports.Where(r => r.Assignment.Start.Year == sYear).Where(r => !r.IsApproved).ToList(); evm.CoursesNoManagers = coursesNoManagers; evm.CoursesNoCmr = coursesNoCmr; evm.NotApprovedReports = notApprovedReports; return(View(evm)); } catch (Exception) { return(View(evm)); } }