public virtual void Dispose(bool disposing) { if (!this.disposed) { if (disposing) { db.Dispose(); } } this.disposed = true; }
//public JsonResult Edit(EditRequest req) //{ // int i; // Trip trip = db.Trips.Find(Convert.ToInt32(req.TripId)); // //Trip newTrip = trip; // Route route = trip.Routes.Where(r => r.DayNum == Convert.ToInt32(req.Day)).First(); // //Route newRoute = route; // List<Routes_Nodes> rns = new List<Routes_Nodes>(); // foreach(string index in req.Values) // { // i = Convert.ToInt32(index); // rns.Add(route.Routes_Nodes.Where(rn => rn.IndexNum == i).First()); // } // List<Node> nodes = new List<Node>(); // foreach(Routes_Nodes rn in rns) // { // nodes.Add(rn.Node); // } // List<Route> result = trip.Routes.OrderBy(x => x.Routes_Nodes.Count).ToList(); // Route minRoute = result[0]; // //save new trip // trip.CreationDate = DateTime.Now; // if (ModelState.IsValid) // { // db.Trips.Add(trip); // db.SaveChanges(); // } // return Json("", JsonRequestBehavior.AllowGet); //} protected override void Dispose(bool disposing) { db.Dispose(); base.Dispose(disposing); }