Ejemplo n.º 1
0
 public static Books UpdateBook(BooksSqlDBContext booksContext, int id, Books book)
 {
     book.Id = id;
     booksContext.Entry(book).State = EntityState.Modified;
     booksContext.SaveChanges();
     return(book);
 }
Ejemplo n.º 2
0
 public static Books AddBook(BooksSqlDBContext booksContext, Books newBook)
 {
     booksContext.Books.Add(newBook);
     booksContext.SaveChanges();
     return(newBook);
 }