Example #1
0
        public async Task AddCityDialog_OnDialogClose(Map_AddCity map_AddCity)
        {
            this.RestaurantSearches    = map_AddCity.RestaurantSearches;
            this.MuseumSearches        = map_AddCity.MuseumSearches;
            map_AddCity.City.CityOrder = this.Cities.Count;
            map_AddCity.City.UserId    = await LocalStorageManagerService.GetPermanentItemAsync("UserId");

            this.Cities.Add(map_AddCity.City);
            if (this.MuseumSearches.Count == 0 && this.RestaurantSearches.Count == 0)
            {
                var serializedCities = JsonConvert.SerializeObject(this.Cities);
                await LocalStorageManagerService.DeletePermanentItemAsync("Cities");

                await LocalStorageManagerService.SavePermanentItemAsync("Cities", serializedCities);
            }
            if (this.MuseumSearches.Count == 0 && map_AddCity.City.NeedsMuseum)
            {
                if (this.RestaurantSearches.Count == 0 && map_AddCity.City.NeedsRestaurant)
                {
                    ShowUnSuccessAlert("Sorry! We couldn't find any restaurants, nor any museums in your area");
                }
                else
                {
                    ShowUnSuccessAlert("Sorry! We couldn't find any museums in your area");
                }
            }
            else
            if (this.RestaurantSearches.Count == 0 && map_AddCity.City.NeedsRestaurant)
            {
                ShowUnSuccessAlert("Sorry! We couldn't find any restaurants in your area");
            }
            ShowSuccessAlert("The city was successfully added to the route!");
        }
Example #2
0
        protected async Task GetUnsavedRoute()
        {
            var serializedCities = await LocalStorageManagerService.GetPermanentItemAsync("Cities");

            if (serializedCities != null)
            {
                this.Cities = JsonConvert.DeserializeObject <List <City> >(serializedCities);
                await ShowRoute();

                ShowSuccessAlert("The route was successfully restored!");
            }
            else
            {
                ShowUnSuccessAlert("You have no route cached in your browser!");
            }
        }
Example #3
0
        protected async Task GetRoutes()
        {
            var userId = await LocalStorageManagerService.GetPermanentItemAsync("UserId");

            CityFilter cityFilter = new CityFilter {
                UserId = userId
            };
            var result = (await CitiesDataService.GetRoutes(cityFilter.GetFilter()));

            if (result?.Routes.Count > 0)
            {
                LastRoutes = result;
            }
            else
            {
                ShowUnSuccessAlert("You have no routes saved in our DB!");
            }
            StateHasChanged();
        }