Example #1
0
        public IActionResult Create(RestaurantEditViewModel model)
        {
            if (ModelState.IsValid)
            {
                var newRestaurant = new Restaurant
                {
                    Cuisine = model.Cuisine,
                    Name    = model.Name
                };

                newRestaurant = restaurantData.Add(newRestaurant);
                restaurantData.Comit();

                return(RedirectToAction("Details", new { id = newRestaurant.Id }));
            }

            return(View());
        }