Beispiel #1
0
 public ActionResult Create([Form] Models.RestaurantReview review)
 {
     if (ModelState.IsValid)
     {
         dbContext.RestaurantReviews.Add(review);
         dbContext.SaveChanges();
         return(RedirectToAction("Index", new { id = review.RestaurantId }));
     }
     return(View(review));
 }
Beispiel #2
0
 public ActionResult Edit([Form] Models.RestaurantReview review)
 {
     if (ModelState.IsValid)
     {
         dbContext.Entry(review).State = EntityState.Modified;
         dbContext.SaveChanges();
         return(RedirectToAction("Index", new { id = review.RestaurantId }));
     }
     return(View(review));
 }
Beispiel #3
0
 public ActionResult Create(Models.RestaurantReview collection)
 {
     try
     {
         dB.SetRestaurantReview(collection);
         _reviews.Add(collection);
         UpdateModel(_reviews);
         return(RedirectToAction("Index"));
     }
     catch
     {
         return(View());
     }
 }