示例#1
0
        public ActionResult Adopt(PetInfoViewModel petVM)
        {
            if (petVM.UserInfo == null || petVM.OwnerInfo == null || petVM.PetInfo == null)
            {
                return(HttpNotFound());
            }

            var adoptionMail = new AdoptionMailViewModel
            {
                AnimalId   = petVM.PetInfo.Id,
                SenderId   = petVM.UserInfo.Id,
                ReceiverId = petVM.OwnerInfo.Id,
                AdoptionId = 0
            };

            return(View("AdoptionConfirmation", adoptionMail));
        }
示例#2
0
        public ActionResult PetInfo(int id)
        {
            var pet = db.Pets.Find(id);

            if (pet == null)
            {
                return(HttpNotFound());
            }

            var owner = db.Users.Find(pet.OwnerId);
            var user  = db.Users.Find(User.Identity.GetUserId());

            var petViewModel = new PetInfoViewModel
            {
                PetInfo   = pet,
                UserInfo  = user,
                OwnerInfo = owner
            };

            return(View("Info", petViewModel));
        }