Ejemplo n.º 1
0
 public void Delete(Book entity)
 {
     using (BookDatabasesContext context = new BookDatabasesContext())
     {
         var deletedEntity = context.Entry(entity);
         deletedEntity.State = EntityState.Deleted;
         context.SaveChanges();
     }
 }
Ejemplo n.º 2
0
 public void Update(Book entity)
 {
     using (BookDatabasesContext context = new BookDatabasesContext())
     {
         var updatedEntity = context.Entry(entity);
         updatedEntity.State = EntityState.Modified;
         context.SaveChanges();
     }
 }
Ejemplo n.º 3
0
 public void Add(Book entity)
 {
     using (BookDatabasesContext context = new BookDatabasesContext())
     {
         var addedEntity = context.Entry(entity);
         addedEntity.State = EntityState.Added;
         context.SaveChanges();
     }
 }