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(); } }
public ActionResult Adoption(AdoptVM adopt) { db.WantsToAdopt(adopt); TempData["message"] = "Pending approval"; return(RedirectToAction("Index")); }