Beispiel #1
0
 public IActionResult Create(Book book, Author author)
 {
     if (ModelState.IsValid)
     {
         DataSource.AddBook(book, author);
     }
     return(RedirectToAction("Index"));
 }
Beispiel #2
0
        public string AddBook(string[] s)
        {
            var date      = DateTime.Parse(s[0]);
            var category  = s[1];
            var title     = s[2];
            var numPage   = Int32.Parse(s[3]);
            var publisher = s[4];
            var price     = Decimal.Parse(s[5]);
            var authorId  = Int32.Parse(s[6]);

            var book = new Book(date, category, title, numPage, publisher, price, authorId);

            return(source.AddBook(book));
        }