public ActionResult DeleteConfirmed(int id) { Restaurantcomments restaurantcomments = db.Restaurantcomments.Find(id); db.Restaurantcomments.Remove(restaurantcomments); db.SaveChanges(); return(RedirectToAction("Index", "Restaurants")); }
public ActionResult Edit([Bind(Include = "Id,Name,RestaurantName,Comment,PostDate")] Restaurantcomments restaurantcomments) { if (ModelState.IsValid) { db.Entry(restaurantcomments).State = EntityState.Modified; db.SaveChanges(); return(RedirectToAction("Index", "Restaurants")); } return(View(restaurantcomments)); }
public ActionResult Create([Bind(Include = "Id,Name,RestaurantName,Comment,PostDate")] Restaurantcomments restaurantcomments) { if (ModelState.IsValid) { restaurantcomments.PostDate = DateTime.Today; db.Restaurantcomments.Add(restaurantcomments); db.SaveChanges(); return(RedirectToAction("Index", "Restaurants")); } return(View(restaurantcomments)); }
// GET: Restaurantcomments/Delete/5 public ActionResult Delete(int?id) { if (id == null) { return(new HttpStatusCodeResult(HttpStatusCode.BadRequest)); } Restaurantcomments restaurantcomments = db.Restaurantcomments.Find(id); if (restaurantcomments == null) { return(HttpNotFound()); } return(View(restaurantcomments)); }