Exemplo n.º 1
0
 public ActionResult Adoption(AdoptionVM model, int id)
 {
     try
     {
         if (ModelState.IsValid)
         {
             Adopter adopter = new Adopter
             {
                 AnimalId                 = id,
                 AnimalType               = model.AnimalType,
                 Name                     = model.Name,
                 Phone                    = model.Phone,
                 Email                    = model.Email,
                 Address                  = model.Address,
                 HouseholdOwnership       = model.HouseholdOwnership,
                 HaveYard                 = model.HaveYard,
                 FamilyMemberConsent      = model.FamilyMemberConsent,
                 IsAllergic               = model.IsAllergic,
                 AllergyNotAProblemReason = model.AllergyNotAProblemReason,
                 HasAdoptedBefore         = model.HasAdoptedBefore,
                 ExistingPet              = model.ExistingPet,
                 ExistingPetType          = model.ExistingPetType,
                 ReasonToAdopt            = model.ReasonToAdopt,
                 Status                   = "Pending"
             };
             adopterService.Insert(adopter);
             ViewBag.Message = "Thank you for your adoption request. We will contact you as soon as possible.";
         }
     }
     catch (Exception e)
     {
         ViewBag.Error     = "Something went wrong! We are Sorry for your inconvenience.";
         ViewBag.Exception = e.InnerException.InnerException.Message;
     }
     return(View(model));
 }