Ejemplo n.º 1
0
        public IActionResult SubmitSuggestion(RestaurantSuggestions restaurant)
        {
            if (ModelState.IsValid)
            {
                restaurant.FavDish = restaurant.FavDish ?? "It's all tasty!";

                TempStorage.AddRestaurant(restaurant);
                return(View("Suggestions", TempStorage.Restaurants));
            }
            return(View());
        }
Ejemplo n.º 2
0
 public IActionResult Suggestion(RestaurantSuggestions restaurant)
 {
     if (restaurant.FavoriteDish == null)
     {
         restaurant.FavoriteDish = "It's all tasty!";
     }
     if (ModelState.IsValid)// This ensures that invalid inputs don't get added to the list #Notcoveredinthevideos!
     {
         RestaurantList.AddRestaurant(restaurant);
         return(View("Confirmation", restaurant)); // passed in the model to let user know that the restaurant was added successfully
     }
     return(View());
 }
Ejemplo n.º 3
0
 public IActionResult Suggestions(RestaurantSuggestions restaurantSuggestions)
 {
     //check to see if the data is entered correctly, if so bring up the list page and store the info temporarily
     if (ModelState.IsValid)
     {
         TempStorage.AddEntry(restaurantSuggestions);
         return(View("SuggestionList", TempStorage.Entry));
     }
     else
     {
         return(View());
     }
 }