public ActionResult Create([Bind(Include = "Id,Name,Active")] Student student) { if (ModelState.IsValid) { db.Students.Add(student); db.SaveChanges(); return(RedirectToAction("Index")); } return(View(student)); }
public ActionResult Create([Bind(Include = "Id,ClassName,StudentId")] Grade grade) { if (ModelState.IsValid) { db.Grades.Add(grade); db.SaveChanges(); return(RedirectToAction("Index")); } ViewBag.StudentId = new SelectList(db.Students, "Id", "Name", grade.StudentId); return(View(grade)); }