public ActionResult Create(int id) { CommentAccessory model = new CommentAccessory(); model.AccessoryId = id; return(View(model)); }
public ActionResult DeleteConfirmed(int id) { CommentAccessory commentAccessory = db.CommentAccessories.Find(id); db.CommentAccessories.Remove(commentAccessory); db.SaveChanges(); return(RedirectToAction("Index")); }
public ActionResult Edit([Bind(Include = "CommentId,Name,Opinion,AccessoryId")] CommentAccessory commentAccessory) { if (ModelState.IsValid) { db.Entry(commentAccessory).State = EntityState.Modified; db.SaveChanges(); return(RedirectToAction("Index")); } return(View(commentAccessory)); }
public ActionResult Create(CommentAccessory commentAccessory) { if (ModelState.IsValid) { db.CommentAccessories.Add(commentAccessory); db.SaveChanges(); return(RedirectToAction("Index", "Accessories")); } return(View(commentAccessory)); }
public ActionResult Edit(int?id) { if (id == null) { return(new HttpStatusCodeResult(HttpStatusCode.BadRequest)); } CommentAccessory commentAccessory = db.CommentAccessories.Find(id); if (commentAccessory == null) { return(HttpNotFound()); } return(View(commentAccessory)); }