public Task <ActionResult> Submit(MyMessageViewModel model) { if (ModelState.IsValid) { var sendEndpoint = _bus.GetSendEndpoint(new Uri(ConfigurationManager.AppSettings["MyCommandQueueFullUri"])).Result; for (int i = 1; i <= model.CommandCount; i++) { sendEndpoint.Send <MyCommand>(new { Message = string.Format("Command{0}", i) }); } for (int i = 1; i <= model.EventCount; i++) { _bus.Publish <MyEvent>(new { Message = string.Format("Event{0}", i) }); } return(Task.FromResult <ActionResult>(RedirectToAction("Index"))); } return(Task.FromResult <ActionResult>(View("Index"))); }
public async Task <ActionResult> Submit(MyMessageViewModel model) { await _bus.Publish <MyMessage>(new { Message = model.Text ?? "Unknown" }); return(View("Index")); }