Exemple #1
0
        public void WantsToAdopt(AdoptVM adopt)
        {
            Volunteer volunteer = new Volunteer();

            volunteer.FirstName      = adopt.FirstName;
            volunteer.LastName       = adopt.LastName;
            volunteer.Type           = VolunteerType.Adopter;
            volunteer.RequestedStart = DateTime.Now;

            using (ApplicationDbContext db = new ApplicationDbContext())
            {
                volunteer.Pet = db.Pets.Find(adopt.PetId);

                db.Volunteers.Add(volunteer);

                db.SaveChanges();
            }
        }
Exemple #2
0
 public ActionResult Adoption(AdoptVM adopt)
 {
     db.WantsToAdopt(adopt);
     TempData["message"] = "Pending approval";
     return(RedirectToAction("Index"));
 }