Exemple #1
0
        // GET: WalkersController/Create
        public ActionResult Create()
        {
            List <Neighborhood> neighborhoods = _neighborhoodRepo.GetAll();

            WalkerFormModel vm = new WalkerFormModel()
            {
                Walker        = new Walker(),
                Neighborhoods = neighborhoods
            };

            return(View(vm));
        }
Exemple #2
0
        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));
            }
        }
Exemple #3
0
        // 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));
        }