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()); } }
public IActionResult Post([FromBody] BookViewModel bookForm) { BookViewModel bookToReturn = _booksService.CreateBook(bookForm); return(Created("createbook", bookToReturn)); }
public async Task <Guid> CreateBook(Book book) { return(await _booksService.CreateBook(book)); }