public JsonResult GetCityName(string term, string QRFID) { CityLookupRequest objCityLookupRequest = new CityLookupRequest(); if (term.Length >= 3 && term.Substring(0, 3) == "###") { term = ""; } objCityLookupRequest.CityName = term; objCityLookupRequest.QRFID = QRFID; SalesProviders objSalesProvider = new SalesProviders(_configuration); CityLookupResponse objCityLookupResponse = objSalesProvider.GetCityList(objCityLookupRequest, token).Result; if (objCityLookupResponse.CityLookupProperties == null) { return(Json("")); } else { List <AutoCompleteTextBox> cityList = new List <AutoCompleteTextBox>(); cityList = objCityLookupResponse.CityLookupProperties.Select(data => new AutoCompleteTextBox { value = data.Voyager_Resort_Id, label = data.Lookup }).ToList(); return(Json(cityList)); } }
public CityLookupResponse GetCityNames([FromBody] CityLookupRequest cityLookupRequest) { var response = new CityLookupResponse(); try { if (cityLookupRequest != null) { IQueryable <CityLookupProperties> result = (IQueryable <CityLookupProperties>)_MasterRepository.GetCityNames(cityLookupRequest); response.ResponseStatus.Status = "Success"; if (result != null && result.Count() > 0) { response.CityLookupProperties = result.OrderBy(a => a.Lookup).ToList(); } else { response.ResponseStatus.ErrorMessage = "No Records Found."; } } else { response.ResponseStatus.Status = "Failure"; response.ResponseStatus.ErrorMessage = "City Name can not be blank."; } } catch (Exception ex) { response.ResponseStatus.Status = "Failure"; response.ResponseStatus.ErrorMessage = "An error occurs " + ex.ToString(); } return(response); }
public async Task <CityLookupResponse> GetCityList(CityLookupRequest objCityLookupRequest, string ticket) { CityLookupResponse objCityLookupResponse = new CityLookupResponse(); objCityLookupResponse = await serviceProxy.PostData(_configuration.GetValue <string>("ServiceMaster:GetCityList"), objCityLookupRequest, typeof(CityLookupResponse), ticket); return(objCityLookupResponse); }
public IQueryable <dynamic> GetCityNames(CityLookupRequest cityLookupRequest) { if (!string.IsNullOrEmpty(cityLookupRequest.CityName)) { if (!string.IsNullOrEmpty(cityLookupRequest.QRFID)) { var lstCities = _MongoContext.mQuote.AsQueryable().Where(p => p.QRFID == cityLookupRequest.QRFID).Select(p => p.RoutingInfo).FirstOrDefault().Select(p => p.ToCityName).Distinct(); return(_MongoContext.mResort.AsQueryable() .Where(c => c.ResortType == "City" && lstCities.Contains(c.Lookup) && c.Lookup.ToLower().Contains(cityLookupRequest.CityName.ToLower().Trim())) .Select(c => new CityLookupProperties { Lookup = c.Lookup, Voyager_Resort_Id = c.Voyager_Resort_Id }).Distinct()); } else { return(_MongoContext.mResort.AsQueryable() .Where(c => c.ResortType == "City" && c.Lookup.ToLower().Contains(cityLookupRequest.CityName.ToLower().Trim())) .Select(c => new CityLookupProperties { Lookup = c.Lookup, Voyager_Resort_Id = c.Voyager_Resort_Id }).Distinct()); } } else { if (!string.IsNullOrEmpty(cityLookupRequest.QRFID)) { var lstCities = _MongoContext.mQuote.AsQueryable().Where(p => p.QRFID == cityLookupRequest.QRFID).Select(p => p.RoutingInfo).FirstOrDefault().Select(p => p.ToCityName).ToList(); return(_MongoContext.mResort.AsQueryable() .Where(c => c.ResortType == "City" && lstCities.Contains(c.Lookup)) .Select(c => new CityLookupProperties { Lookup = c.Lookup, Voyager_Resort_Id = c.Voyager_Resort_Id }).Distinct()); } else { return(_MongoContext.mResort.AsQueryable() .Where(c => c.ResortType == "City") .Select(c => new CityLookupProperties { Lookup = c.Lookup, Voyager_Resort_Id = c.Voyager_Resort_Id }).Distinct().Take(100)); } } }