public List<TripsModel> GetAll() { try { TripsDataLayerRealm dl = new TripsDataLayerRealm(); List<TripsModel> list = new List<TripsModel>(); List<TripsRealmModel> models = dl.GetAll(); foreach (TripsRealmModel model in models) { TripsModel realmModel = new TripsModel(); realmModel.direction_id = model.direction_id; realmModel.route_id = model.route_id; realmModel.service_id = model.service_id; realmModel.shape_id = model.shape_id; realmModel.trip_headsign = model.trip_headsign; realmModel.trip_id = model.trip_id; realmModel.trip_short_name = model.trip_short_name; list.Add(realmModel); } //list = list.OrderBy(x => x.a_descrizione).ToList(); return list; } catch (Exception pException) { System.Diagnostics.Debug.WriteLine("Error TripsBusinness->GetAll " + pException.Message); } return null; }
public ActionResult Delete(int id) { TripsModel trp = binder.trips.Find(id); binder.trips.Remove(trp); binder.SaveChanges(); return(RedirectToAction("Index")); }
public ActionResult Edit(TripsModel trip) { if (ModelState.IsValid) { binder.Entry(trip).State = System.Data.Entity.EntityState.Modified; binder.SaveChanges(); } return(RedirectToAction("Index")); }
public ActionResult Edit(int id) { TripsModel trp = binder.trips.Find(id); if (trp == null) { return(HttpNotFound()); } ViewBag.placeName = new SelectList(binder.location, "Id", "PlaceName"); ViewBag.coachType = new SelectList(binder.coach, "Id", "CoachType"); return(View(trp)); }
public ActionResult Save(TripsModel trips) { if (ModelState.IsValid) { try { binder.trips.Add(trips); binder.SaveChanges(); } catch (Exception e) { } } return(RedirectToAction("Index")); }