예제 #1
0
        public async Task <IEnumerable <SavedJourney> > GetSavedJourneyForUser(int userId)
        {
            var list = await _savedJourneyRepository.GetSavedJourneyForUser(userId);

            foreach (var savedJourney in list)
            {
                var journey = await _journeyDataService.GetJourneyDetails(savedJourney.JourneyId);

                journey.FromCity = await _cityDataService.GetCityById(journey.FromCityId);

                journey.ToCity = await _cityDataService.GetCityById(journey.ToCityId);

                savedJourney.Journey   = journey;
                savedJourney.JourneyId = journey.JourneyId;
            }

            return(list);
        }
예제 #2
0
        public async Task <IEnumerable <SavedRemittance> > GetSavedRemittanceForUser(int userId)
        {
            var list = await _savedRemittanceRepository.GetSavedRemittanceForUser(userId);

            foreach (var savedRemittance in list)
            {
                var remittance = await _remittanceDataService.GetRemittanceDetails(savedRemittance.RemittanceId);

                remittance.FromCity = await _cityDataService.GetCityById(remittance.FromCityId);

                remittance.ToCity = await _cityDataService.GetCityById(remittance.ToCityId);

                savedRemittance.Remittance   = remittance;
                savedRemittance.RemittanceId = remittance.RemittanceId;
            }

            return(list);
        }
        public City GetCityById(int CityId, out TransactionalInformation transaction)
        {
            transaction = new TransactionalInformation();
            City             city             = null;
            CityBusinessRule cityBusinessRule = new CityBusinessRule();

            try
            {
                cityDataService.CreateSession();

                cityBusinessRule.validateCityRequestByCityId(CityId);

                if (cityBusinessRule.ValidationStatus == true)
                {
                    city = cityDataService.GetCityById(CityId, out transaction);
                }
                else
                {
                    transaction.ReturnStatus     = cityBusinessRule.ValidationStatus;
                    transaction.ReturnMessage    = cityBusinessRule.ValidationMessage;
                    transaction.ValidationErrors = cityBusinessRule.ValidationErrors;
                }
            }
            catch (Exception ex)
            {
                transaction.ReturnMessage = new List <string>();
                string errorMessage = ex.Message;
                transaction.ReturnStatus = false;
                transaction.ReturnMessage.Add(errorMessage);
            }
            finally
            {
                cityDataService.CloseSession();
            }

            return(city);
        }