示例#1
0
        public ActionResult Create(BookVM bookVM)
        {
            try
            {
                BookDTO bookDTO = new BookDTO
                {
                    Name   = bookVM.Name,
                    Author = bookVM.Author,
                    Amount = bookVM.Amount
                };

                booksService.CreateBook(bookDTO);

                return(RedirectToAction("Index"));
            }
            catch
            {
                return(View());
            }
        }
示例#2
0
        public IActionResult Post([FromBody] BookViewModel bookForm)
        {
            BookViewModel bookToReturn = _booksService.CreateBook(bookForm);

            return(Created("createbook", bookToReturn));
        }
示例#3
0
 public async Task <Guid> CreateBook(Book book)
 {
     return(await _booksService.CreateBook(book));
 }