public async Task <PartnerCountryCityRes> GetPartnerCityDetailsBasedOnName([FromBody] TravelogiCountryCityRes request) { var response = new PartnerCountryCityRes(); try { if (request != null) { response = await _genericRepository.GetPartnerCityDetailsBasedOnName(request); if (string.IsNullOrEmpty(response.ResortInfo.Voyager_Resort_Id)) { response.ResponseStatus.Status = "Failure"; response.ResponseStatus.ErrorMessage = "City not found."; } } else { response.ResponseStatus.Status = "Failure"; response.ResponseStatus.ErrorMessage = "City not found."; } } catch (Exception ex) { response.ResponseStatus.Status = "Failure"; response.ResponseStatus.ErrorMessage = "An Error Occurs :- " + ex.Message; } return(response); }
public async Task <PartnerCountryCityRes> GetPartnerCityDetailsBasedOnName(TravelogiCountryCityRes CityInfo) { PartnerCountryCityRes response = new PartnerCountryCityRes(); var City = _MongoContext.mResort.AsQueryable().Where(a => a.ResortName.ToLower() == CityInfo.TargetSupplierCityName.ToLower() && a.ParentResortCode.ToLower() == CityInfo.TargetSupplierCountryCode.ToLower() && a.ResortType == "City").FirstOrDefault(); if (City == null) { return(response); } response.ResortInfo = City; return(response); }
public async Task <PartnerCountryCityRes> GetPartnerCityDetails(Attributes request, string countryCode, string countryResortCode, string ticket) { PartnerCountryCityRes response = new PartnerCountryCityRes(); response = await serviceProxy.PostData(_configuration.GetValue <string>("ServiceCommon:GetPartnerCityDetails"), request, typeof(PartnerCountryCityRes), ticket); if (response.ResponseStatus != null && !string.IsNullOrEmpty(response.ResponseStatus.Status) && response.ResponseStatus.Status.ToLower() == "failure") { var cityInfo = new List <TravelogiCountryCityReq>(); TravelogiCountryCityReq d = new TravelogiCountryCityReq(); d.SourceSupplierCode = _configuration.GetValue <string>("TravelogiData:SourceSupplierCode"); d.SourceSupplierCityCode = request.Attribute_Id; d.SourceSupplierCountryCode = countryCode; d.TargetSupplierCode = _configuration.GetValue <string>("TravelogiData:TargetSupplierCode"); cityInfo.Add(d); List <TravelogiCountryCityRes> responseData = await serviceProxy.PostForTravelogiData(_configuration.GetValue <string>("Travelogi:CityMapping"), cityInfo, typeof(List <TravelogiCountryCityRes>)); if (responseData != null && responseData.Any() && !string.IsNullOrEmpty(responseData[0].Status) && responseData[0].Status == "Mapped") { TravelogiCountryCityRes TravelogiCityInfo = new TravelogiCountryCityRes(); TravelogiCityInfo = responseData[0]; TravelogiCityInfo.TargetSupplierCityName = TravelogiCityInfo.TargetSupplierCityName.Trim(); TravelogiCityInfo.TargetSupplierCountryCode = countryResortCode; //Based on CityCode /*response = await serviceProxy.PostData(_configuration.GetValue<string>("ServiceCommon:GetPartnerCityDetailsBasedOnCode"), * responseData[0].TargetSupplierCityCode, typeof(PartnerCountryCityRes), ticket);*/ response = await serviceProxy.PostData(_configuration.GetValue <string>("ServiceCommon:GetPartnerCityDetailsBasedOnName"), TravelogiCityInfo, typeof(PartnerCountryCityRes), ticket); } } return(response); }