public ActionResult Edit([Bind(Include = "CourseId,CourseName")] Course course) { if (ModelState.IsValid) { db.Entry(course).State = EntityState.Modified; db.SaveChanges(); return(RedirectToAction("Index")); } return(View(course)); }
public ActionResult Edit([Bind(Include = "StudentId,StudentName")] Student student) { if (ModelState.IsValid) { db.Entry(student).State = EntityState.Modified; db.SaveChanges(); return(RedirectToAction("Index")); } return(View(student)); }
public ActionResult Edit([Bind(Include = "AddressId,AddressDesc,StudentId")] Address address) { if (ModelState.IsValid) { db.Entry(address).State = EntityState.Modified; db.SaveChanges(); return(RedirectToAction("Index")); } ViewBag.StudentId = new SelectList(db.student, "StudentId", "StudentName", address.StudentId); return(View(address)); }
public ActionResult SaveStudent(Student student) { DbFile db = new DbFile(); if (student.ID == 0) { db.student.Add(student); db.SaveChanges(); } else { db.Entry(student).State = EntityState.Modified; db.SaveChanges(); } return(RedirectToAction("StudentDetail")); }