View model for page to view all people in database
Added to program 7/25/2012
示例#1
0
        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;
        }