Exemple #1
0
        public async Task <Travel> CreateTravelAsync(Travel travel)
        {
            var organizer = await CompanyRepository.GetByIdAsync(travel.CompanyOrganizer.Id);

            if (organizer == null)
            {
                throw new NotFoundException("Компания не найдена!");
            }

            var region = await RegionRepository.GetByIdAsync(travel.Region.Id);

            if (region == null)
            {
                throw new NotFoundException("Регион не найден!");
            }

            return(await TravelRepository.CreateAsync(travel));
        }