예제 #1
0
        // GET: walkers/details/1023
        public ActionResult Details(int id)
        {
            Walker walker = _walkerRepo.GetWalkerById(id);

            if (walker == null)
            {
                return(NotFound());
            }

            List <Walk> walks            = _walkRepo.GetByWalksByWalkerId(id);
            int         totalWalkSeconds = walks.Sum(w => w.Duration);
            TimeSpan    walkTime         = TimeSpan.FromSeconds(totalWalkSeconds);
            string      walkTimeDisplay  = $"{walkTime.Hours}hr {walkTime.Minutes}min";

            WalkerProfileViewModel vm = new WalkerProfileViewModel()
            {
                Walker = walker,
                Walks  = walks,
                TotalTimeWalkedDisplay = walkTimeDisplay
            };


            return(View(vm));
        }