public ActionResult DeleteConfirmed(short id) { MetroRoute metroRoute = db.MetroRoutes.Find(id); db.MetroRoutes.Remove(metroRoute); db.SaveChanges(); return(Json(db.MetroRoutes.ToList())); }
public ActionResult Edit([Bind(Include = "id,UserId,SequenceOfStations,Name")] MetroRoute metroRoute) { if (ModelState.IsValid) { db.Entry(metroRoute).State = EntityState.Modified; db.SaveChanges(); return(RedirectToAction("Index")); } return(View(metroRoute)); }
// GET: MetroRoutes/Edit/5 public ActionResult Edit(short?id) { if (id == null) { return(new HttpStatusCodeResult(HttpStatusCode.BadRequest)); } MetroRoute metroRoute = db.MetroRoutes.Find(id); if (metroRoute == null) { return(HttpNotFound()); } return(View(metroRoute)); }
public ActionResult Create([Bind(Include = "id,UserId,SequenceOfStations,Name")] MetroRoute metroRoute) { if (metroRoute.SequenceOfStations == null) { return(Json(metroRoute)); } if (ModelState.IsValid) { db.MetroRoutes.Add(metroRoute); db.SaveChanges(); return(Json(db.MetroRoutes.ToList())); } //return View(metroRoute); return(Json(metroRoute)); }