public async Task <LocationStatus> AddNewLocation(string _location) { var locationRepository = DependencyService.Get <ILocationRepository>(); var locationDb = locationRepository.GetAll().Where(l => l.Name.ToUpper().Equals(_location.ToUpper())).FirstOrDefault(); if (locationDb == null) { var locationApi = await LocationHelper.GetLocationWoeid(_location, Navigation); if (locationApi != null) { LocationHelper.SaveNewLocation(locationApi); await LocationHelper.GetWeatherAsync(); return(LocationStatus.Found); } } else { return(LocationStatus.AlreadyExists); } return(LocationStatus.NotFound); }
public async Task <DAL.Entities.Location> GetLocationWoeid(string _location) { try { IsVisible = true; var location = await LocationHelper.GetLocationWoeid(_location); return(location ?? null); } finally { IsVisible = false; } }