示例#1
0
        // GET: OwnerController/Details/5
        public ActionResult Details(int id)
        {
            int currentUser = GetCurrentUserId();

            if (id != currentUser)
            {
                return(NotFound());
            }

            Owner         owner   = _ownerRepository.GetOwnerById(id);
            List <Dog>    dogs    = _dogRepository.GetDogByOwnerId(owner.Id);
            List <Walker> walkers = _walkerRepository.GetWalkersInNeighborhood(owner.NeighborhoodId);
            List <Walk>   walks   = _walkRepository.GetWalksByOwnerId(currentUser);

            ProfileViewModel vm = new ProfileViewModel()
            {
                Owner   = owner,
                Dogs    = dogs,
                Walkers = walkers,
                Walks   = walks
            };

            return(View(vm));
        }