// // GET: /Route/ public ActionResult Index() { var viewRoute = new RouteDTO { RouteList = repository.GetAllRoutes(), }; return View(viewRoute); }
public ActionResult Create(RouteDTO routeDTO) { var route = repository.CreateRoute(routeDTO); if (ModelState.IsValid) { db.Routes.Add(route); db.SaveChanges(); return RedirectToAction("Index"); } return View(route); }
// // GET: /Route/Details/5 public ActionResult Details(int id) { var route = repository.GetRoute(id); var routeView = new RouteDTO { Depature = route.Depature, Destination = route.Destination, Duration = route.Duration, }; if (routeView == null) { return HttpNotFound(); } return View(routeView); }
public Models.Route UpdateRoute(RouteDTO routeDTO) { var route = new Route { RouteId = routeDTO.RouteId, Depature = routeDTO.Depature, Destination = routeDTO.Destination, Duration = routeDTO.Duration, }; return route; }
public Models.Route CreateRoute(RouteDTO routeDTO) { var route = new Route { Depature = routeDTO.Depature, Destination = routeDTO.Destination, Duration = routeDTO.Duration }; return route; }
// // GET: /Route/Edit/5 public ActionResult Edit(int id) { Route route = repository.GetRoute(id); var routeView = new RouteDTO { RouteId = route.RouteId, Depature = route.Depature, Destination = route.Destination, Duration = route.Duration }; if (routeView == null) { return HttpNotFound(); } return View(routeView); }
public ActionResult Edit(RouteDTO routeDTO) { var route = repository.UpdateRoute(routeDTO); if (ModelState.IsValid) { db.Entry(route).State = EntityState.Modified; db.SaveChanges(); return RedirectToAction("Index"); } return View(route); }