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 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();
        }