public void UpdateDVD(DVD dvd) { var repository = new DVDContext(); var chosenDVD = repository.DVDs.FirstOrDefault(d => d.DVDId == dvd.DVDId); repository.Entry(chosenDVD).CurrentValues.SetValues(dvd); repository.SaveChanges(); }
public ActionResult Edit([Bind(Include = "ID,Title,PurchaseDate")] Titles titles) { if (ModelState.IsValid) { db.Entry(titles).State = EntityState.Modified; db.SaveChanges(); return(RedirectToAction("Index")); } return(View(titles)); }
public ActionResult Edit([Bind(Include = "dvdId,dvdTitle,dvdDirector,genre")] dvd dvd) { if (ModelState.IsValid) { db.Entry(dvd).State = EntityState.Modified; db.SaveChanges(); return(RedirectToAction("Index")); } return(View(dvd)); }