Пример #1
0
 private static void insertBookShort(Book book)
 {
     var query = string.Format(
         @"INSERT INTO Books ('Title', 'Image', 'Status')
         values ('{0}', '{1}', '{2}')",
         book.Title, book.Image, DbSelectCommand.GetStatesLike(book.Status)[0]);
 }
Пример #2
0
        //TODO: make multiple authors and genres
        public static void PinnAuthorToBook(Book book, Author author)
        {
            var query = string.Format("INSERT INTO BookAuthors ('Book', 'Author') values ('{0}', '{1}')",
                                      DbSelectCommand.GetBooksWithTitle(book.Title)[0].Id,
                                      DbSelectCommand.GetAuthorsLike(author.Name)[0]);

            DbConnection.Update(query);
        }
Пример #3
0
 public static bool IsBookWithTitleExist(string title)
 {
     if (DbSelectCommand.FindBookWithTitle(title).Count > 0)
     {
         return(true);
     }
     return(false);
 }
Пример #4
0
 private static void insertBook(Book book)
 {
     var query = string.Format(
         @"INSERT INTO Books ('Title', 'Image', 'Series', 'Status', 'Rating', 'Comment', 'Link')
         values ('{0}', '{1}', '{2}', '{3}', '{4}', '{5}', '{6}')",
         book.Title, book.Image, DbSelectCommand.GetSeriesLike(book.Series)[0],
         DbSelectCommand.GetStatesLike(book.Status)[0], book.Rating, book.Comment, book.Link);
 }
Пример #5
0
 public static bool IsBookExist(string title, string author)
 {
     if (DbSelectCommand.FindBook(title, author).Count > 0)
     {
         return(true);
     }
     return(false);
 }
Пример #6
0
 public static bool IsBookExist(int id)
 {
     if (DbSelectCommand.GetBook(id) != null)
     {
         return(true);
     }
     return(false);
 }
Пример #7
0
 public static bool IsStatusExist(string param)
 {
     if (DbSelectCommand.GetStatesLike(param).Count > 0)
     {
         return(true);
     }
     return(false);
 }
Пример #8
0
 public static bool IsAuthorExist(string param)
 {
     if (DbSelectCommand.GetAuthorsLike(param).Count > 0)
     {
         return(true);
     }
     return(false);
 }
Пример #9
0
        public static void PinnGenreToBook(Book book, Genre genre)
        {
            var query = string.Format("INSERT INTO BookGenres ('Book', 'Genre') values ('{0}', '{1}')",
                                      DbSelectCommand.GetBooksWithTitle(book.Title)[0].Id,
                                      DbSelectCommand.GetGenresLike(genre.Name)[0]);

            DbConnection.Update(query);
        }