public Book UpdateBook(Book book)
        {
            var oldBook = _context.Books.FirstOrDefault(b => b.BookId == book.BookId);

            _context.Entry(oldBook).CurrentValues.SetValues(book);
            return(book);
        }
Exemple #2
0
        public ProductBase UpdateProduct(ProductBase product)
        {
            var oldProduct = GetProduct(product.Id);

            _context.Entry(oldProduct).CurrentValues.SetValues(product);
            _context.SaveChanges();
            return(product);
        }
Exemple #3
0
        public Author UpdateAuthor(Author author)
        {
            var oldAuthor = GetAuthor(author.AuthorId);

            _context.Entry(oldAuthor).CurrentValues.SetValues(author);
            _context.SaveChanges();
            return(author);
        }
        public ProductState UpdateProductState(ProductState productState)
        {
            var oldState = _context.ProductStates.FirstOrDefault(p => p.Id == productState.Id);

            _context.Entry(oldState).CurrentValues.SetValues(productState);
            _context.SaveChanges();
            return(productState);
        }
        public Publisher UpdatePublisher(Publisher publisher)
        {
            var oldPubl = GetPublisher(publisher.Id);

            _context.Entry(oldPubl).CurrentValues.SetValues(publisher);
            _context.SaveChanges();
            return(publisher);
        }
Exemple #6
0
        public Category UpdateCategory(Category category)
        {
            var oldCategory = _context.Categories.FirstOrDefault(c => c.Id == category.Id);

            _context.Entry(oldCategory).CurrentValues.SetValues(category);
            _context.SaveChanges();
            return(category);
        }
        public Language UpdateLanguage(Language lang)
        {
            var oldLang = GetLanguage(lang.Id);

            _context.Entry(oldLang).CurrentValues.SetValues(lang);
            _context.SaveChanges();
            return(lang);
        }
Exemple #8
0
        public Format UpdateFormat(Format format)
        {
            var oldFormat = GetFormat(format.Id);

            _context.Entry(oldFormat).CurrentValues.SetValues(format);
            _context.SaveChanges();
            return(format);
        }