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