Пример #1
0
        protected ConcertListViewModel GetConcerts(int venueId = 0, int cityId = 0)
        {
            var concertList = _concertRepository.GetConcertList(venueId, cityId);
            var venueList   = _venueRepository.GetVenues(venueId, cityId);

            return(new ConcertListViewModel()
            {
                ConcertList = concertList.ConcertsList.Select(c => new ConcertListViewModel.ConcertViewModel()
                {
                    ConcertId = c.ConcertId,
                    Name = c.ConcertName,
                    Date = c.ConcertDate,
                    Performer = c.PerformerModel.ShortName,
                    Venue = c.VenueModel.VenueName
                }).ToList(),
                VenueList = venueList.Select(v => new ConcertListViewModel.VenueViewModel()
                {
                    VenueId = v.VenueId,
                    VenueName = v.VenueName,
                    CityId = v.VenueCityModel.CityId,
                    CityName = v.VenueCityModel.CityName,
                    StateId = v.VenueCityModel.StateModel.StateId,
                    StateName = v.VenueCityModel.StateModel.StateName,
                    ConcertCount = v.ConcertQty
                }).ToList()
            });
        }