Beispiel #1
0
        public BookRecommedation UpdateRecommendationNote(long noteId, string content)
        {
            var recommedation = BookRecommedations.SingleOrDefault(e => e.NoteId == noteId);

            if (recommedation is null)
            {
                throw new LibraryException("Note not found");
            }
            recommedation.Note = new Note(content);
            return(recommedation);
        }
Beispiel #2
0
        public void AddBookRecommendation(Book sourceBook, Book recommendedBook, string note = "")
        {
            if (!IsBookInLibrary(sourceBook))
            {
                throw new LibraryException("Source book not in library");
            }

            var rec = new BookRecommedation(recommendedBook)
            {
                PersonalLibraryId = this.Id,
                SourceBook        = sourceBook,
                Note = new Note(note)
            };

            BookRecommedations.Add(rec);
        }