public ActionResult DeleteConfirmed(int id) { Tooded tooded = db.Toodeds.Find(id); db.Toodeds.Remove(tooded); db.SaveChanges(); return(RedirectToAction("Index")); }
public ActionResult Edit([Bind(Include = "Id,Toode,Hind,Jääk")] Tooded tooded) { if (ModelState.IsValid) { db.Entry(tooded).State = EntityState.Modified; db.SaveChanges(); return(RedirectToAction("Index")); } return(View(tooded)); }
public ActionResult Create([Bind(Include = "Id,Toode,Hind,Jääk")] Tooded tooded) { if (ModelState.IsValid) { db.Toodeds.Add(tooded); db.SaveChanges(); return(RedirectToAction("Index")); } return(View(tooded)); }
// GET: Toodeds/Delete/5 public ActionResult Delete(int?id) { if (id == null) { return(new HttpStatusCodeResult(HttpStatusCode.BadRequest)); } Tooded tooded = db.Toodeds.Find(id); if (tooded == null) { return(HttpNotFound()); } return(View(tooded)); }