예제 #1
0
        // GET: DogController/Details/5
        public ActionResult Details(int id)
        {
            Dog dog = _dogRepo.GetDogById(id);

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

            List <Walk>         walks     = _walkRepo.GetWalksByDogId(id);
            DogProfileViewModel viewModel = new DogProfileViewModel
            {
                Dog   = dog,
                Walks = walks.Where(walk => walk.WalkStatusId == 3).ToList()
            };

            return(View(viewModel));
        }
예제 #2
0
        // GET: DogController1/Details/5
        public ActionResult Details(int id)
        {
            Dog         dog           = _dogRepo.GetDogById(id);
            List <Walk> walks         = _walkRepo.GetWalksByDogId(id);
            int         currentUserId = GetCurrentUserId();

            if (dog.OwnerId != currentUserId)
            {
                return(NotFound());
            }
            if (dog == null)
            {
                return(NotFound());
            }

            DogProfileViewModel vm = new DogProfileViewModel()
            {
                Dog   = dog,
                Walks = walks
            };

            return(View(vm));
        }