public IActionResult Edit(Experience experience) { var thisPersonId = Int32.Parse(Request.Form["People"]); var thisPerson = db.People.FirstOrDefault(People => People.PersonId == thisPersonId); thisPerson.ExperienceId = experience.ExperienceId; var thisExperiencePeople = new ExperiencePeople { }; thisExperiencePeople.ExperienceId = experience.ExperienceId; thisExperiencePeople.PersonId = thisPerson.PersonId; db.ExperiencePeople.Add(thisExperiencePeople); db.Entry(experience).State = EntityState.Modified; db.SaveChanges(); return(RedirectToAction("Index")); }
public IActionResult Create(ExperiencePeople experiencePeople) { db.ExperiencesPeoples.Add(experiencePeople); db.SaveChanges(); return(RedirectToAction("Index")); }