public ActionResult Create(Person person) { try { db.People.Add(person); var employer = new Employer { SSN = person.SSN, Person = person }; // create a new employer with same SSN as person and establish relationship with Person// db.Employers.Add(employer); db.SaveChanges(); return RedirectToAction("Index"); } catch { return View(); } }
public ActionResult Create(Person person) { try { // TODO: Add insert logic here db.People.Add(person); var jobSeeker = new JobSeeker {SSN = person.SSN, Person= person}; db.JobSeekers.Add(jobSeeker); db.SaveChanges(); return RedirectToAction("Index"); } catch { return View(); } }