Esempio n. 1
0
        public Book UpdateBook(EditBookViewModel view)
        {
            var book = GetBookById(view.Id);

            book.Author         = view.Author;
            book.NumberPages    = view.NumberPages;
            book.PublishingYear = view.PublishingYear;
            var publication = _publications.Where(x => x.Id == book.Publication.Id).FirstOrDefault();

            publication.Name = view.PublicationName;
            _publicationRepository.Update(publication);
            _publicationRepository.Save();
            _bookRepository.Update(book);
            _bookRepository.Save();
            return(book);
        }