Esempio n. 1
0
        public IActionResult NewBook(Book newBook)
        {
            BookData.Add(newBook);


            return(Redirect("/Books"));
        }
Esempio n. 2
0
        public int Add(Book book)
        {
            if (book.MyProperty < 0)
            {
                return(0);
            }
            bookData.Add(book);

            return(1);
        }
        public IActionResult OnPost()
        {
            if (!ModelState.IsValid)
            {
                this.Categories = HtmlHelper.GetEnumSelectList <Category> ();
                return(Page());
            }

            if (Book.ISN > 0)
            {
                BookData.Update(Book);
            }
            else
            {
                BookData.Add(Book);
            }
            BookData.Commit();
            TempData["Message"] = "Book Saved";
            return(RedirectToPage("./Detail", new { isn = Book.ISN }));
        }
Esempio n. 4
0
 public int Add(Book model)
 {
     return(_bookData.Add(model));;
 }