Ejemplo n.º 1
0
        // GET: WalkersController/Details/5
        public ActionResult Details(int id)
        {
            Walker walker = _walkerRepo.GetWalkerById(id);

            walker.Neighborhood = _hoodRepo.GetNeighborhoodByWalker(id);
            List <Walks> walks = _walksRepo.GetWalksByWalker(walker.Id);
            int          totalWalksDuration = 0;

            foreach (Walks walk in walks)
            {
                walk.Duration       = walk.Duration / 60;
                totalWalksDuration += walk.Duration;
            }



            if (walker == null)
            {
                return(NotFound());
            }
            WalkerViewModel vm = new WalkerViewModel()
            {
                Walker             = walker,
                Walks              = walks,
                TotalWalksDuration = totalWalksDuration
            };

            return(View(vm));
        }