Esempio n. 1
0
        public ActionResult DeleteConfirmed(short id)
        {
            MetroRoute metroRoute = db.MetroRoutes.Find(id);

            db.MetroRoutes.Remove(metroRoute);
            db.SaveChanges();
            return(Json(db.MetroRoutes.ToList()));
        }
Esempio n. 2
0
 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));
 }
Esempio n. 3
0
        // 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));
        }
Esempio n. 4
0
        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));
        }