Exemplo n.º 1
0
        public void Add(Dvd dvd)
        {
            var repository = new DvdListEntities();

            repository.Dvds.Add(dvd);
            repository.SaveChanges();
        }
Exemplo n.º 2
0
        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();
            }
        }
Exemplo n.º 3
0
        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();
        }