Example #1
0
        public IActionResult Index()
        {
            var user = authProvider.GetCurrentUser();

            // This is where I started using VM
            PetsUserViewModel vm = new PetsUserViewModel();

            vm.User = userDAL.GetUser(user.Username);
            vm.Pets = petDAO.GetAllPets(user.Id);

            // used to pass in user
            return(View(vm));
        }
Example #2
0
        public IActionResult Reservation()
        {
            if (!authProvider.IsLoggedIn)
            {
                return(RedirectToAction("Login", "Account"));
            }
            var user = authProvider.GetCurrentUser();

            ReservationUserViewModel vm = new ReservationUserViewModel();

            vm.User         = userDAL.GetUser(user.Username);
            vm.Reservations = reservationDAO.GetAllReservationsForUser(user.Id);
            vm.Pets         = petDAO.GetAllPets(user.Id);

            return(View(vm));
        }