public void AddDvd(Dvd dvd) { using (var db = new MovieDBEntity()) { db.Dvds.Add(dvd); db.SaveChanges(); } }
public void DeleteDvd(int dvdId) { using (var db = new MovieDBEntity()) { Dvd toRemove = db.Dvds.SingleOrDefault(d => d.dvdId == dvdId); if (toRemove != null) { db.Dvds.Remove(toRemove); } db.SaveChanges(); } }
public void EditDvd(Dvd dvdId) { using (var db = new MovieDBEntity()) { Dvd toEdit = db.Dvds.SingleOrDefault(d => d.dvdId == dvdId.dvdId); if (toEdit != null) { toEdit.director = dvdId.director; toEdit.notes = dvdId.notes; toEdit.rating = dvdId.rating; toEdit.realeaseYear = dvdId.realeaseYear; toEdit.title = dvdId.title; db.SaveChanges(); } } }