public ActionResult Create([Bind(Include = "Id,Name,Address,City,State,Zip,Phone,Web,Country,ImageUrl")] Restaurant restaurant) { if (ModelState.IsValid) { db.Restaurants.Add(restaurant); db.SaveChanges(); return(RedirectToAction("Index")); } return(View(restaurant)); }
public ActionResult Create(Review review) { if (ModelState.IsValid) { review.ReviewDate = DateTime.Now; if (Request.IsAuthenticated) { review.ReviewerName = User.Identity.GetUserName(); } db.Reviews.Add(review); db.SaveChanges(); return(RedirectToAction("Index", new { id = review.RestaurantId })); } return(View(review)); }