// GET: WalkersController/Create public ActionResult Create() { List <Neighborhood> neighborhoods = _neighborhoodRepo.GetAll(); WalkerFormModel vm = new WalkerFormModel() { Walker = new Walker(), Neighborhoods = neighborhoods }; return(View(vm)); }
public ActionResult Edit(int id, Walker walker) { try { _walkerRepo.UpdateWalker(walker); return(RedirectToAction("Index")); } catch (Exception) { WalkerFormModel vm = new WalkerFormModel() { Walker = walker, Neighborhoods = _neighborhoodRepo.GetAll() }; return(View(vm)); } }
// GET: WalkersController/Edit/5 public ActionResult Edit(int id) { Walker walker = _walkerRepo.GetWalkerById(id); if (walker == null) { return(NotFound()); } List <Neighborhood> neighborhoods = _neighborhoodRepo.GetAll(); WalkerFormModel vm = new WalkerFormModel() { Walker = walker, Neighborhoods = neighborhoods }; return(View(vm)); }