public bool Update(int id, BookEntity entry) { var book = MapBook(entry); using (var db = new LibraryDataModel()) { db.Books.Attach(book); db.Entry(entry).State = EntityState.Modified; return(db.SaveChanges() > 0); } }
public bool Update(int id, AuthorEntity entry) { var author = MapAuthor(entry); using (var db = new LibraryDataModel()) { db.Author.Attach(author); db.Entry(entry).State = EntityState.Modified; return(db.SaveChanges() > 0); } }