コード例 #1
0
        public int AddBook(ServiceBook book)
        {
            int id = unit.Books.Create(book.ToDalBook());

            unit.Save();
            return(id);
        }
コード例 #2
0
        public ServiceFullBook GetFullBookInfo(ServiceBook book)
        {
            var             dalBook = book.ToDalBook();
            ServiceFullBook fBook   = new ServiceFullBook
            {
                BookData    = book,
                Authors     = unit.Books.GetAuthors(dalBook).Select(e => e.ToServiceAuthor()),
                Comments    = unit.Comments.FindAll(e => e.BookID == dalBook.ID).Select(e => e.ToServiceComment()),
                Contents    = unit.Contents.FindAll(e => e.BookID == dalBook.ID).Select(e => e.ToServiceContent()),
                Likes       = unit.Likes.FindAll(e => e.BookID == dalBook.ID).Select(e => e.ToServiceLike()),
                Lists       = unit.Books.GetLists(dalBook).Select(e => e.ToServiceList()),
                Review      = unit.Reviews.FindAll(e => e.BookID == dalBook.ID).Select(e => e.ToServiceReview()),
                Covers      = unit.Books.GetCovers(dalBook).Select(e => e.ToServiceCover()),
                Files       = unit.Books.GetFiles(dalBook).Select(e => e.ToServiceFile()),
                Genres      = unit.Books.GetGenres(dalBook).Select(e => e.ToServiceGenre()),
                Screeninigs = unit.Books.GetScreenings(dalBook).Select(e => e.ToServiceScreening()),
                Tags        = unit.Books.GetTags(dalBook).Select(e => e.ToServiceTag())
            };

            return(fBook);
        }
コード例 #3
0
 public void AddBookTag(ServiceBook book, ServiceTag tag)
 {
     unit.Books.AddTag(book.ToDalBook(), tag.ToDalTag());
     unit.Save();
 }
コード例 #4
0
 public void AddBookGenre(ServiceBook book, ServiceGenre genre)
 {
     unit.Books.AddGenre(book.ToDalBook(), genre.ToDalGenre());
     unit.Save();
 }
コード例 #5
0
 public void RemoveListBook(ServiceList list, ServiceBook book)
 {
     unit.Lists.DeleteBook(list.ToDalList(), book.ToDalBook());
     unit.Save();
 }
コード例 #6
0
 public void RemoveBookTag(ServiceBook book, ServiceTag tag)
 {
     unit.Books.DeleteTag(book.ToDalBook(), tag.ToDalTag());
     unit.Save();
 }
コード例 #7
0
 public void RemoveBookGenre(ServiceBook book, ServiceGenre genre)
 {
     unit.Books.DeleteGenre(book.ToDalBook(), genre.ToDalGenre());
     unit.Save();
 }
コード例 #8
0
 public void UpdateBook(ServiceBook book)
 {
     unit.Books.Update(book.ToDalBook());
     unit.Save();
 }
コード例 #9
0
 public void AddAuthorBook(ServiceAuthor author, ServiceBook book)
 {
     unit.Books.AddAuthor(book.ToDalBook(), author.ToDalAuthor());
     unit.Save();
 }
コード例 #10
0
 public IEnumerable <ServiceCover> GetBookCovers(ServiceBook book)
 {
     return(unit.Books.GetCovers(book.ToDalBook())?.Select(e => e.ToServiceCover()));
 }
コード例 #11
0
 public IEnumerable <ServiceAuthor> GetBookAuthors(ServiceBook book)
 {
     return(unit.Books.GetAuthors(book.ToDalBook()).Select(e => e.ToServiceAuthor()));
 }
コード例 #12
0
 public void AddScreening(ServiceBook book, ServiceScreening screening)
 {
     unit.Books.AddScreening(book.ToDalBook(), screening.ToDalScreening());
     unit.Save();
 }
コード例 #13
0
 public void AddFile(ServiceBook book, ServiceFile file)
 {
     unit.Books.AddFile(book.ToDalBook(), file.ToDalFile());
     unit.Save();
 }
コード例 #14
0
 public void AddCover(ServiceBook book, ServiceCover cover)
 {
     unit.Books.AddCover(book.ToDalBook(), cover.ToDalCover());
     unit.Save();
 }
コード例 #15
0
 public void AddListBook(ServiceList list, ServiceBook book)
 {
     unit.Lists.AddBook(list.ToDalList(), book.ToDalBook());
     unit.Save();
 }
コード例 #16
0
 public void AddBook(ServiceCollection collection, ServiceBook book)
 {
     unit.Collections.AddBook(collection.ToDalCollection(), book.ToDalBook());
     unit.Save();
 }
コード例 #17
0
 public IEnumerable <ServiceFile> GetBookFiles(ServiceBook book)
 {
     return(unit.Books.GetFiles(book.ToDalBook())?.Select(e => e.ToServiceFile()));
 }
コード例 #18
0
 public void RemoveAuthorBook(ServiceAuthor author, ServiceBook book)
 {
     unit.Books.DeleteAuthor(book.ToDalBook(), author.ToDalAuthor());
     unit.Save();
 }
コード例 #19
0
 public void RemoveBook(ServiceBook book)
 {
     unit.Books.Delete(book.ToDalBook());
     unit.Save();
 }