Exemple #1
0
        public IActionResult RegisterPet(PetsUserViewModel vm)
        {
            var user = authProvider.GetCurrentUser();

            vm.User       = userDAL.GetUserById(user.Id);
            vm.Pet.UserId = vm.User.Id;
            petDAO.AddPet(vm.Pet);

            return(RedirectToAction("Index", "Account"));
        }
Exemple #2
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));
        }