Пример #1
0
        private async Task <IActionResult> GetSpecificTour <T>(Guid tourId) where T : class
        {
            var tourFromRepo = await _tourRepository.GetTour(tourId);

            if (tourFromRepo == null)
            {
                return(BadRequest());
            }

            var tour = Mapper.Map <T>(tourFromRepo);

            return(Ok(tour));
        }
        public async Task <IActionResult> GetShows(Guid tourId)
        {
            var tourFromRepo = await _tourRepository.GetTour(tourId, true);

            if (!(await _tourRepository.TourExists(tourId)))
            {
                return(NotFound());
            }

            var showsFromRepo = await _tourRepository.GetShows(tourId);

            var shows = Mapper.Map <IEnumerable <ShowDto> >(showsFromRepo);

            return(Ok(shows));
        }
Пример #3
0
 public Contracts.Tour GetTour(int tourId)
 {
     return(_mapper.Map <Model.Tour, Contracts.Tour>(_tourRepository.GetTour(tourId)));
 }