public static AdminIndexViewModel Create(IRepositoryFactory repositoryFactory, string site) { var seminar = SiteService.GetLatestSeminar(site); var viewModel = new AdminIndexViewModel() { PendingInformationRequests = repositoryFactory.InformationRequestRepository.Queryable.Where(a => a.Site.Id == site).Count(a => !a.Responded), PendingApplications = repositoryFactory.ApplicationRepository.Queryable.Count(a => a.Seminar.Id == seminar.Id && a.IsPending), ApprovedApplications = repositoryFactory.ApplicationRepository.Queryable.Count(a => a.Seminar.Id == seminar.Id && !a.IsPending && a.IsApproved), DeniedApplications = repositoryFactory.ApplicationRepository.Queryable.Count(a => a.Seminar.Id == seminar.Id && !a.IsPending && !a.IsApproved), Registered = repositoryFactory.SeminarPersonRepository.Queryable.Count(a => a.Seminar.Id == seminar.Id && a.Paid), PeopleMissingBiography = repositoryFactory.SeminarPersonRepository.Queryable.Count(a => a.Seminar.Id == seminar.Id && a.Paid && a.Person.Biography != null && a.Person.Biography != string.Empty), PeopleMissingPhoto = repositoryFactory.SeminarPersonRepository.Queryable.Count(a => a.Seminar.Id == seminar.Id && a.Paid && a.Person.OriginalPicture == null), PeopleMissingHotel = repositoryFactory.SeminarPersonRepository.Queryable.Count(a => a.Seminar.Id == seminar.Id && a.Paid && a.HotelConfirmation != null && a.HotelConfirmation != string.Empty) }; return(viewModel); }
public ActionResult Admin() { var viewModel = AdminIndexViewModel.Create(RepositoryFactory, Site); return(View(viewModel)); }