public ActionResult Edit([Bind(Include = "Id,Description,MajorId")] Class @class) { if (ModelState.IsValid) { db.Entry(@class).State = EntityState.Modified; db.SaveChanges(); return(RedirectToAction("Index")); } return(View(@class)); }
public ActionResult Edit([Bind(Include = "Id,FirstName,LastName,MajorId,Sat")] Student student) { if (ModelState.IsValid) { db.Entry(student).State = EntityState.Modified; db.SaveChanges(); return(RedirectToAction("Index")); } return(View(student)); }
public ActionResult Edit([Bind(Include = "Id,Kickoff,Url")] Fixture fixture) { if (ModelState.IsValid) { db.Entry(fixture).State = EntityState.Modified; db.SaveChanges(); return(RedirectToAction("Index")); } return(View(fixture)); }
public ActionResult Edit([Bind(Include = "Id,Name")] School school) { if (ModelState.IsValid) { db.Entry(school).State = EntityState.Modified; db.SaveChanges(); return(RedirectToAction("Index")); } return(View(school)); }
public ActionResult Edit([Bind(Include = "Id,StudentId,ClassId,Grade")] Enrolled enrolled) { if (ModelState.IsValid) { db.Entry(enrolled).State = EntityState.Modified; db.SaveChanges(); return(RedirectToAction("Index")); } return(View(enrolled)); }
public RegisteredStudent Delete(DeletedStudent deletedStudent) { using (SchoolDataContext schoolContext = new SchoolDataContext()) { Student studentToDelete = (Student)schoolContext.Students.Where(b => b.Id == deletedStudent.Id).First(); schoolContext.Entry(studentToDelete).State = System.Data.Entity.EntityState.Deleted; schoolContext.SaveChanges(); return(studentToDelete.toDTO()); } }
public ActionResult Edit([Bind(Include = "Id,Description,MinSat")] Major major) { if (ModelState.IsValid) { db.Entry(major).State = EntityState.Modified; db.SaveChanges(); return(RedirectToAction("Index")); } return(View(major)); }
public RegisteredStudent Update(UpdateStudent updateRegistry) { using (SchoolDataContext schoolContext = new SchoolDataContext()) { var studentToUpdate = updateRegistry.ToEntity(); schoolContext.Students.Attach(studentToUpdate); //schoolContext.Entry(studentToUpdate).Property(x => x.Name).IsModified = true; schoolContext.Entry(studentToUpdate).State = System.Data.Entity.EntityState.Modified; schoolContext.SaveChanges(); return(studentToUpdate.toDTO()); } }