public void Add(Dvd dvd) { var repository = new DvdListEntities(); repository.Dvds.Add(dvd); repository.SaveChanges(); }
public void Delete(int ID) { var repository = new DvdListEntities(); Dvd model = repository.Dvds.FirstOrDefault(c => c.dvdId.Equals(ID)); if (repository.Dvds.Any(c => c.dvdId == ID)) { repository.Dvds.Remove(model); repository.SaveChanges(); } }
public void Edit(Dvd dvd) { var repository = new DvdListEntities(); Dvd model = repository.Dvds.FirstOrDefault(d => d.dvdId.Equals(dvd.dvdId)); model.title = dvd.title; model.releasedYear = dvd.releasedYear; model.director = dvd.director; model.rating = dvd.rating; model.notes = dvd.notes; repository.SaveChanges(); }