public ActionResult DeleteConfirmed(int id) { Guidao guidao = db.Guidoes.Find(id); db.Guidoes.Remove(guidao); db.SaveChanges(); return(RedirectToAction("Index")); }
public ActionResult Edit([Bind(Include = "GuidaoID,Nome,Preco")] Guidao guidao) { if (ModelState.IsValid) { db.Entry(guidao).State = EntityState.Modified; db.SaveChanges(); return(RedirectToAction("Index")); } return(View(guidao)); }
public ActionResult Create([Bind(Include = "GuidaoID,Nome,Preco")] Guidao guidao) { if (ModelState.IsValid) { db.Guidoes.Add(guidao); db.SaveChanges(); return(RedirectToAction("Index")); } return(View(guidao)); }
// GET public ActionResult Delete(int?id) { if (id == null) { return(new HttpStatusCodeResult(HttpStatusCode.BadRequest)); } Guidao guidao = db.Guidoes.Find(id); if (guidao == null) { return(HttpNotFound()); } return(View(guidao)); }