Skip to content

Instantly share code, notes, and snippets.

@seburgi
Last active December 26, 2015 12:49
Show Gist options
  • Save seburgi/7153920 to your computer and use it in GitHub Desktop.
Save seburgi/7153920 to your computer and use it in GitHub Desktop.
example for async controller action with NServiceBus
[HttpPost]
public async Task<ActionResult> Edit(ApplicationDto model)
{
if (ModelState.IsValid)
{
AppErrorCodes errorCode = await
Bus.Send(new UpdateApplication
{
Id = model.Id,
Name = model.Name,
ShortName = model.ShortName,
}).Register<AppErrorCodes>();
if (errorCode == AppErrorCodes.None)
{
return RedirectToAction("Edit", new {model.Id});
}
}
return PartialView("_Edit", model);
}
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment