Beispiel #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!");
        }
Beispiel #2
0
        protected async Task NewRoute()
        {
            this.Cities.Clear();
            await JSRuntime.InvokeVoidAsync("removeDirections");

            await LocalStorageManagerService.DeletePermanentItemAsync("Cities");

            ShowSuccessAlert("Here we go! Now you can start all over again!");
            StateHasChanged();
        }
Beispiel #3
0
        protected async Task SaveRoute()
        {
            if (this.Cities.Count > 0)
            {
                await CitiesDataService.SavePathAsync(Cities);

                await LocalStorageManagerService.DeletePermanentItemAsync("Cities");

                ShowSuccessAlert("Route successfully saved!");
            }
            else
            {
                ShowUnSuccessAlert("There is no route to be saved!");
            }
        }
Beispiel #4
0
        protected async Task RestaurantSelected(GoogleTextSearchDTO restaurant)
        {
            this.Cities[Cities.Count() - 1].SelectedRestaurant = restaurant;
            this.RestaurantSearches.Clear();
            if (this.MuseumSearches.Count == 0 && this.RestaurantSearches.Count == 0)
            {
                var serializedCities = JsonConvert.SerializeObject(this.Cities);
                await LocalStorageManagerService.DeletePermanentItemAsync("Cities");

                await LocalStorageManagerService.SavePermanentItemAsync("Cities", serializedCities);
            }
            await JSRuntime.InvokeVoidAsync("hideLocation");

            ShowSuccessAlert("Restaurant selected");
            StateHasChanged();
        }
Beispiel #5
0
 protected override async Task OnAfterRenderAsync(bool firstRender)
 {
     await LocalStorageManagerService.DeletePermanentItemAsync("Token");
 }