public static AdminPeopleViewModel Create(IRepositoryFactory repositoryFactory, Site site, int?seminarId) { var viewModel = new AdminPeopleViewModel() { Site = site, Seminars = repositoryFactory.SeminarRepository.Queryable.Where(a => a.Site == site).ToList() }; if (seminarId.HasValue) { viewModel.People = repositoryFactory.PersonRepository.Queryable.Where(a => a.SeminarPeople.Select(b => b.Seminar.Id).Contains(seminarId.Value)); } else { viewModel.People = repositoryFactory.PersonRepository.Queryable; } return(viewModel); }
public static AdminPeopleViewModel Create(IRepositoryFactory repositoryFactory, Site site, int? seminarId) { var viewModel = new AdminPeopleViewModel() { Site = site, Seminars = repositoryFactory.SeminarRepository.Queryable.Where(a => a.Site == site).ToList() }; if (seminarId.HasValue) { viewModel.People = repositoryFactory.PersonRepository.Queryable.Where(a => a.SeminarPeople.Select(b => b.Seminar.Id).Contains(seminarId.Value)); } else { viewModel.People = repositoryFactory.PersonRepository.Queryable; } return viewModel; }