public void DvdDelete(int dvdId) { var repo = new DVDLibraryEntities1(); repo.Dvds.Remove(repo.Dvds.Single(d => d.dvdId == dvdId)); repo.SaveChanges(); }
public void DvdEdit(int dvdId, Dvd dvd) { var repo = new DVDLibraryEntities1(); repo.Dvds.Remove(repo.Dvds.Single(d => d.dvdId == dvdId)); repo.Dvds.Add(dvd); repo.SaveChanges(); }
public void DvdCreate(Dvd dvd) { var repo = new DVDLibraryEntities1(); if (repo.Dvds.Any()) { dvd.dvdId = repo.Dvds.Max(d => d.dvdId) + 1; } else { dvd.dvdId = 0; } repo.Dvds.Add(dvd); repo.SaveChanges(); }