public static async Task <IList <City> > GetAsync() { try { var rest = new CityRest(); var result = await rest.GetAsync(string.Empty); if (result.IsValid) { SetLocalCities(result.Value); return(result.Value); } else { return(GetLocalCities()); } } catch (Exception ex) { var exception = DependencyService.Get <IExceptionService>(); exception.TrackError(ex, "AccountManager.GetAsync"); return(new List <City> { DefaultSetting.City }); } }
public static async Task <City> SetActualCity() { try { var position = await GeolocatorHelper.GetCurrentPositionAsync(); var cityService = new CityRest(); var cityName = await cityService.GetCityNameAsync(position.Latitude, position.Longitude); cityName = string.IsNullOrWhiteSpace(cityName) ? DefaultSetting.City.Name : cityName; var result = await cityService.GetCityAsync(cityName.Trim()); var city = result.Value ?? DefaultSetting.City; ApplicationManager <City> .AddOrUpdate("city", city); return(city); } catch (Exception ex) { var exception = DependencyService.Get <IExceptionService>(); exception.TrackError(ex, "SetActualCity"); return(DefaultSetting.City); } }
public async Task <string> GetCityName(double latitude, double longitude) { var service = new CityRest(); var cityName = await service.GetCityName(latitude, longitude); return(cityName); }
public async Task <City> GetByNameAsync(string search) { var service = new CityRest(); var city = await service.GetCityAsync(search); return(city); }
public static async Task <IList <City> > GetHasHistoricalSightAsync() { var rest = new CityRest(); var cities = await rest.GetHasHistoricalSightAsync() ?? GetLocalCities(); SetLocalCities(cities); return(cities); }
public static async Task <IList <City> > GetHasCompanyAsync(int subCategoryId) { var rest = new CityRest(); var cities = await rest.GetHasCompanyAsync(subCategoryId) ?? GetLocalCities(); SetLocalCities(cities); return(cities); }
public static async Task <IList <City> > GetAsync() { var rest = new CityRest(); var cities = await rest.GetAsync(string.Empty) ?? GetLocalCities(); SetLocalCities(cities); return(cities); }
public async Task <IList <City> > GetHasHistoricalSightAsync() { var service = new CityRest(); var items = await service.GetHasHistoricalSightAsync(); ApplicationManager <string> .AddOrUpdate("cities", items); return(items.OrderBy(o => o.Name).ToList()); }
public async Task <IList <City> > GetHasCompanyAsync(int subCategoryId) { var service = new CityRest(); var items = await service.GetHasCompanyAsync(subCategoryId); ApplicationManager <string> .AddOrUpdate("cities", items); return(items.OrderBy(o => o.Name).ToList()); }
public static async Task <IList <City> > GetHasEventAsync() { var rest = new CityRest(); var result = await rest.GetHasEventAsync(); if (result.IsValid) { SetLocalCities(result.Value); return(result.Value); } else { return(GetLocalCities()); } }
public static async Task <IList <City> > GetHasCompanyAsync(int subCategoryId) { var rest = new CityRest(); var result = await rest.GetHasCompanyAsync(subCategoryId); if (result.IsValid) { SetLocalCities(result.Value); return(result.Value); } else { return(GetLocalCities()); } }