Ejemplo n.º 1
0
        // GET: OwnerController/Details/5
        public ActionResult Details(int id)
        {
            Owner owner = _ownerRepo.GetOwnerById(id);

            ProfileViewModel vm = new ProfileViewModel()
            {
                Owner   = _ownerRepo.GetOwnerById(id),
                Dogs    = _dogRepo.GetAllDogsWithOwner(owner.Id),
                Walkers = _walkerRepo.GetWalkersInNeighborhood(owner.NeighborhoodId)
            };

            return(View(vm));
        }
Ejemplo n.º 2
0
        // GET: OwnersController/Details/5
        public ActionResult Details(int id)
        {
            ProfileViewModel vm = new ProfileViewModel();

            vm.Dogs  = _dogRepo.GetDogsByOwnerId(id);
            vm.Owner = _ownerRepo.GetOwnerById(id);
            if (vm.Owner == null)
            {
                return(NotFound());
            }
            vm.Walkers = _walkerRepo.GetWalkersInNeighborhood(vm.Owner.NeighborhoodId);

            return(View(vm));
        }
Ejemplo n.º 3
0
 public ActionResult Index()
 {
     try
     {
         int           currentOwner = GetCurrentUserId();
         Owner         owner        = _ownerRepo.GetOwnerById(currentOwner);
         List <Walker> walkers      = _walkerRepo.GetWalkersInNeighborhood(owner.NeighborhoodId);
         return(View(walkers));
     }
     catch (ArgumentNullException ex)
     {
         return(View(_walkerRepo.GetAllWalkers()));
     }
 }
Ejemplo n.º 4
0
 // GET: WalkersController
 public ActionResult Index()
 {
     if (User.Identity.IsAuthenticated)
     {
         Owner         currentUser  = _ownerRepo.GetOwnerById(GetCurrentUserId());
         List <Walker> localWalkers = _walkerRepo.GetWalkersInNeighborhood(currentUser.NeighborhoodId);
         return(View(localWalkers));
     }
     else
     {
         List <Walker> walkers = _walkerRepo.GetAllWalkers();
         return(View(walkers));
     }
 }
Ejemplo n.º 5
0
        // GET: WalkersController
        public ActionResult Index()
        {
            Owner owner = _ownerRepo.GetOwnerById(GetCurrentUserId());

            if (owner != null)
            {
                List <Walker> neighborhoodWalkers = _walkerRepo.GetWalkersInNeighborhood(owner.NeighborhoodId);
                return(View(neighborhoodWalkers));
            }
            else
            {
                List <Walker> allWalkers = _walkerRepo.GetAllWalkers();
                return(View(allWalkers));
            }
        }
Ejemplo n.º 6
0
        // GET: OwnersController

        public ActionResult Index()
        {
            try
            {
                int   ownerId = GetCurrentUserId();
                Owner owner   = _ownerRepo.GetOwnerById(ownerId);

                List <Dog>    dogs    = _dogRepo.GetDogsByOwnerId(owner.Id);
                List <Walker> walkers = _walkerRepo.GetWalkersInNeighborhood(owner.NeighborhoodId);


                ProfileViewModel vm = new ProfileViewModel()
                {
                    Owner   = owner,
                    Dogs    = dogs,
                    Walkers = walkers
                };
                return(View(vm));
            }
            catch
            {
                return(RedirectToAction("Create", "Owner"));
            }
        }
Ejemplo n.º 7
0
        // GET: Owners/Details/5
        public ActionResult Details(int id)
        {
            Owner         owner   = _ownerRepo.GetOwnerById(id);
            List <Dog>    dogs    = _dogRepo.GetDogsByOwnerId(owner.Id);
            List <Walker> walkers = _walkerRepo.GetWalkersInNeighborhood(owner.NeighborhoodId);

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

            return(View(vm));
        }
Ejemplo n.º 8
0
 // GET: WalkersController
 public ActionResult Index()
 {
     try
     {
         int           OwnerId = GetCurrentUserId();
         Owner         owner   = _ownerRepo.GetOwnerById(OwnerId);
         List <Walker> walkers = _walkerRepo.GetWalkersInNeighborhood(owner.NeighborhoodId);
         return(View(walkers));
     }
     catch
     {
         List <Walker> walkers = _walkerRepo.GetAllWalkers();
         return(View(walkers));
     }
 }
Ejemplo n.º 9
0
        // GET: Walkers
        public ActionResult Index()
        {
            List <Walker> walkers = new List <Walker>();

            try
            {
                Owner currentUser = _ownerRepo.GetOwnerById(GetCurrentUserId());
                walkers = _walkerRepo.GetWalkersInNeighborhood(currentUser.NeighborhoodId);
            }
            catch
            {
                walkers = _walkerRepo.GetAllWalkers();
            }

            return(View(walkers));
        }
Ejemplo n.º 10
0
        // GET: Walkers
        public ActionResult Index()
        //This code will get the walkers in the Walker table that are in the same neighborhood as the current user/owner, convert it to a List and pass it off to the view.
        {
            List <Walker> walkers = new List <Walker>();

            try
            {
                Owner currentOwner = _ownerRepo.GetOwnerById(GetCurrentUserId());
                walkers = _walkerRepo.GetWalkersInNeighborhood(currentOwner.NeighborhoodId);
            }
            catch
            {
                walkers = _walkerRepo.GetAllWalkers();
            }

            return(View(walkers));
        }
Ejemplo n.º 11
0
        // GET: WalkersController
        public ActionResult Index()
        {
            int           ownerId = GetCurrentUserId();
            List <Walker> walkers = new List <Walker>();

            if (ownerId == 0)
            {
                walkers = _walkerRepo.GetAllWalkers();
                return(View(walkers));
            }
            else
            {
                Owner currentUser = _ownerRepo.GetOwnerById(ownerId);
                walkers = _walkerRepo.GetWalkersInNeighborhood(currentUser.NeighborhoodId);
                return(View(walkers));
            }
        }
 // GET: Walkers
 public ActionResult Index()
 {
     try
     {
         int           currentOwnerId        = GetCurrentUserId();
         Owner         currentOwner          = _ownerRepo.GetOwnerById(currentOwnerId);
         int           currentNeighborhoodId = currentOwner.NeighborhoodId;
         List <Walker> walkers = _walkerRepo.GetWalkersInNeighborhood(currentNeighborhoodId);
         if (currentNeighborhoodId != currentOwner.NeighborhoodId)
         {
             return(NotFound());
         }
         return(View(walkers));
     }
     catch
     {
         List <Walker> allWalkers = _walkerRepo.GetAllWalkers();
         return(View(allWalkers));
     }
 }
Ejemplo n.º 13
0
        // GET: Walkers
        public ActionResult Index()
        {
            bool truthyValue = (User != null) && User.Identity.IsAuthenticated;

            if (truthyValue)
            {
                int   ownerId = GetCurrentUserId();
                Owner owner   = _ownerRepo.GetOwnerById(ownerId);

                List <Walker> walkers = _walkerRepo.GetWalkersInNeighborhood(owner.NeighborhoodId);

                return(View(walkers));
            }
            else
            {
                List <Walker> walkers = _walkerRepo.GetAllWalkers();

                return(View(walkers));
            }
        }