public ActionResult AddBookAsync(AddBookViewModel model) { if (ModelState.IsValid) { // Create message from the data entered. Messages.AddBookCommand msg = new AddBookCommand() { Title = model.Title, Author = model.Author, Copies = model.Copies }; // Send the message through the bus to the endpoint (defined in Web.Config) // This is an Asynchronous call. Bus.Send(msg) .Register<CommandSatus>(result => { // NServiceBus Callback function: store the result in the AsyncManager. AsyncManager.Parameters["result"] = result; }); } return RedirectToAction("Index"); }
public ActionResult AddBook() { var newBook = new AddBookViewModel(); return View(newBook); }