Ejemplo n.º 1
0
 public void Add(Book book)
 {
     if (book.isCorrectState())
     {
         bookDao.Add(book);
     }
     else
     {
         throw new ArgumentException("Error, Added book in incorrec state (empty fields)");
     }
 }
Ejemplo n.º 2
0
 public bool Add(Book book)
 {
     if (validation.Validate(book).Count > 0)
     {
         foreach (var res in validation.Validate(book))
         {
             if (res.IsValidate)
             {
                 logger.Error(res.ValidationMessage.ToString());
             }
         }
     }
     return(books.Add(book));
 }
Ejemplo n.º 3
0
        protected override void Add()
        {
            _ui.PrintLn("Authors:");
            foreach (var a in _authorDao.GetAll())
            {
                _ui.PrintLn(a);
            }

            int    authorId = _ui.ReadInt("Author ID", 0);
            Author author   = _authorDao.Get(authorId);

            if (author == null)
            {
                _ui.PrintLn("Author was not found!");
                return;
            }

            string title = _ui.ReadString("Title", "Z");

            _bookDao.Add(new Book(author, title));
        }
Ejemplo n.º 4
0
 public Book Add(Book book) => _bookDao.Add(book);
Ejemplo n.º 5
0
 public IActionResult Add([FromForm] Book b)
 {
     _bookDao.Add(b);
     return(Ok());
 }