public ActionResult Create(StudyInformation studyinformation) { if (ModelState.IsValid) { db.StudyInfos.Add(studyinformation); db.SaveChanges(); return RedirectToAction("Index"); } ViewBag.StudyId = new SelectList(db.Studies, "Id", "Name", studyinformation.StudyId); return View(studyinformation); }
public ActionResult Edit(StudyInformation studyinformation) { if (ModelState.IsValid) { db.Entry(studyinformation).State = EntityState.Modified; db.SaveChanges(); return RedirectToAction("Index"); } ViewBag.StudyId = new SelectList(db.Studies, "Id", "Name", studyinformation.StudyId); return View(studyinformation); }