Exemplo n.º 1
0
 public ActionResult Create(Restaurant restaurant, int CuisineId)
 {
     _db.Restaurants.Add(restaurant);
     if (CuisineId != 0)
     {
         _db.CuisineRestaurant.Add(new CuisineRestaurant()
         {
             CuisineId = CuisineId, RestaurantId = restaurant.RestaurantId
         });
     }
     _db.SaveChanges();
     return(RedirectToAction("Index"));
 }
 public ActionResult Create(Cuisine cuisine)
 {
     foreach (Cuisine cus in _db.Cuisines)
     {
         if (cus.Type == cuisine.Type)
         {
             return(RedirectToAction("Index"));
         }
     }
     _db.Cuisines.Add(cuisine);
     _db.SaveChanges();
     return(RedirectToAction("Index"));
 }
        public ActionResult Create(Restaurant restaurant)
        {
            _db.Restaurant.Add(restaurant);
            _db.SaveChanges();
            Cuisine theCuisine = _db.Cuisine.FirstOrDefault(cuisine => cuisine.CuisineId == restaurant.CuisineId);

            return(RedirectToAction("Details", "Cuisine", new { id = theCuisine.CuisineId }));
        }
Exemplo n.º 4
0
 public ActionResult Create(Cuisine cuisine)
 {
     try
     {
         if (String.IsNullOrWhiteSpace(cuisine.Type))
         {
             throw new System.InvalidOperationException("invalid input");
         }
         else
         {
             _db.Cuisines.Add(cuisine);
             _db.SaveChanges();
             return(RedirectToAction("Index"));
         }
     }
     catch (Exception ex)
     {
         return(View("Error", ex.Message));
     }
 }
 public ActionResult Create(Restaurant restaurant)
 {
     try
     {
         if (String.IsNullOrWhiteSpace(restaurant.Name) || String.IsNullOrWhiteSpace(restaurant.PriceRange))
         {
             throw new System.InvalidOperationException("invalid input");
         }
         else
         {
             _db.Restaurants.Add(restaurant);
             _db.SaveChanges();
             return(RedirectToAction("Index"));
         }
     }
     catch (Exception ex)
     {
         return(View("Error", ex.Message));
     }
 }
 public ActionResult Create(Review review)
 {
     try
     {
         if (String.IsNullOrWhiteSpace(review.Title) || String.IsNullOrWhiteSpace(review.Description))
         {
             throw new System.InvalidOperationException("invalid input");
         }
         else
         {
             _db.Reviews.Add(review);
             _db.SaveChanges();
             return(RedirectToAction("Index"));
         }
     }
     catch (Exception ex)
     {
         return(View("Error", ex.Message));
     }
 }
Exemplo n.º 7
0
 public ActionResult Create(Cousine cousine)
 {
     _db.CousineGroup.Add(cousine);
     _db.SaveChanges();
     return(RedirectToAction("Index"));
 }
Exemplo n.º 8
0
 public ActionResult Create(Restaurant restaurant)
 {
     _db.Restaurants.Add(restaurant);
     _db.SaveChanges();
     return(RedirectToAction("Index"));
 }
Exemplo n.º 9
0
 public ActionResult Create(Cuisine cuisine)
 {
     _db.Cuisines.Add(cuisine);
     _db.SaveChanges();
     return(RedirectToAction("Index"));
 }
Exemplo n.º 10
0
 public ActionResult Create(Review review)
 {
     _db.Reviews.Add(review);
     _db.SaveChanges();
     return(RedirectToAction("Index"));
 }
 public ActionResult Create(Review review)
 {
     _db.Reviews.Add(review);
     _db.SaveChanges();
     return(RedirectToAction("Details", "Restaurants", new { id = review.RestaurantId }));
 }
Exemplo n.º 12
0
 public ActionResult Create(Restaurant restaurant)
 {
     _db.Restaurants.Add(restaurant);
     _db.SaveChanges();
     return(RedirectToAction("Upload", new { id = restaurant.Id }));
 }
Exemplo n.º 13
0
 public ActionResult Create(Review review, int cuisineId)
 {
     _db.Reviews.Add(review);
     _db.SaveChanges();
     return(Redirect("cuisine/{cuisineId}/restaurant/{review.Id}"));
 }