예제 #1
0
        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);
            }
        }
예제 #2
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);
            }
        }