Example #1
0
 public string Save(Book aBook)
 {
     if (bookGateway.HasBookName(aBook.Title))
     {
         throw new Exception("This system has this book name.Please try again.");
     }
     else if (bookGateway.HasISBNNo(aBook.ISbnNo))
     {
         throw new Exception("This system already have this ISBN No.Please try again.");
     }
     else
     {
         return(bookGateway.Save(aBook));
     }
 }
Example #2
0
        public string Save(Book abook)
        {
            if (bookGateway.IsISBNExists(abook.Isbn))
            {
                return("ISBN exists");
            }
            if (abook.Isbn.Length != 13)
            {
                return("ISBN must thirteen 13 characters long.");
            }
            int rowAffected = bookGateway.Save(abook);

            if (rowAffected > 0)
            {
                return("Book saved succesfully");
            }
            return("Book saved failed");
        }