コード例 #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);
            }
        }