public ActionResult Create(Review review, int id)
 {
     review.RestaurantId = id;
     _db.Reviews.Add(review);
     _db.SaveChanges();
     return(RedirectToAction("Index", "Restaurants", id));
 }
예제 #2
0
        public ActionResult DeleteConfirmed(int id)
        {
            var thisCuisine = _db.Cuisines.FirstOrDefault(cuisines => cuisines.CuisineId == id);

            _db.Cuisines.Remove(thisCuisine);
            _db.SaveChanges();
            return(RedirectToAction("Index"));
        }
예제 #3
0
 public ActionResult Create(Seattle seattle)
 {
     try {
         _db.Seattle.Add(seattle);
         _db.SaveChanges();
     } catch (DbUpdateException e) {
         TempData["ErrorMessage"] = "Duplicate Area";
     }
     return(RedirectToAction("Index"));
 }
예제 #4
0
        public ActionResult Create(Restaurant restaurant)
        {
            try{
                _db.Restaurants.Add(restaurant);
                _db.SaveChanges();
            } catch (DbUpdateException e)
            {
                TempData["ErrorMessage"] = "Duplicate Restaurant";
            }

            return(RedirectToAction("Index"));
        }
        public async Task <ActionResult> Create(Restaurant restaurant, int CuisineId)
        {
            var userId      = this.User.FindFirst(ClaimTypes.NameIdentifier)?.Value;
            var currentUser = await _userManager.FindByIdAsync(userId);

            restaurant.User = currentUser;
            _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(string reviewText, string reviewerName, string reviewScore, string restaurantId)
        {
            Restaurant restaurant = _db.Restaurants.FirstOrDefault(restaurants => restaurants.RestaurantId == int.Parse(restaurantId));
            Review     review     = new Review(reviewText, reviewerName, int.Parse(reviewScore));

            restaurant.Reviews.Add(review);
            _db.SaveChanges();
            return(RedirectToAction("Details", "Restaurants", new { id = review.RestaurantId }));
        }
 public ActionResult Create(Restaurant restaurant)
 {
     _db.Restaurants.Add(restaurant);
     _db.SaveChanges();
     return(RedirectToAction("Index"));
 }
예제 #8
0
 public ActionResult Create(Cuisine cuisine)
 {
     _db.Cuisines.Add(cuisine);
     _db.SaveChanges();
     return(RedirectToAction("Index"));
 }
예제 #9
0
 public ActionResult Create(FoodCuisine foodcuisine)
 {
     _db.FoodCuisines.Add(foodcuisine);
     _db.SaveChanges();
     return(RedirectToAction("Index"));
 }
 public ActionResult Create(Dish dish)
 {
     _db.Dishes.Add(dish);
     _db.SaveChanges();
     return(RedirectToAction("Index"));
 }
예제 #11
0
 public ActionResult Create(Review review)
 {
     _db.Reviews.Add(review);
     _db.SaveChanges();
     return(RedirectToAction("Details", "Restaurants", new { id = review.RestaurantId }));
 }
 public ActionResult Create(Review review)
 {
     _db.Reviews.Add(review);
     _db.SaveChanges();
     return(RedirectToAction("Index"));
 }
예제 #13
0
 public ActionResult Create(Rating rating)
 {
     _db.Ratings.Add(rating);
     _db.SaveChanges();
     return(RedirectToAction("Show", "Restaurant", new { id = rating.RestaurantId }));
 }