public void IndexAsync(string textField) { int number; if (!int.TryParse(textField, out number)) return; AsyncManager.OutstandingOperations.Increment(); var command = new Command { Id = number }; Bus.Send(command).Register(SimpleCommandCallback, this); }
public ActionResult Index(string textField) { ViewBag.Title = "SendAndBlock"; int number; if (!int.TryParse(textField, out number)) return View(); var command = new Command { Id = number }; IAsyncResult res = Bus.Send(command).Register(SimpleCommandCallback, this); WaitHandle asyncWaitHandle = res.AsyncWaitHandle; asyncWaitHandle.WaitOne(50000); return View(); }