Пример #1
0
        public async Task <NewTravel> AddTravel(NewTravel newTravel, string userMail)
        {
            newTravel.TravelId = userMail + newTravel.TravelDestination.City + newTravel.TravelDestination.Country + newTravel.ArrivalDate;
            var dbTravel = TravelConverter.ToDbTravel(newTravel);
            var response = await TravelRepository.AddTravelToUser(dbTravel, userMail);

            return(TravelConverter.ToDomainTravel(response));
        }
Пример #2
0
        public async Task <IEnumerable <TravelsResponse> > GetTravels(string userMail)
        {
            var response = await TravelRepository.GetTravels(userMail);

            var travelsList = new List <TravelsResponse>();

            foreach (var travel in response)
            {
                var location = await LocationRepository.GetLocation(travel.TravelId);

                travelsList.Add(TravelConverter.ToDomainTravel(travel, location));
            }
            return(travelsList);
        }