Last active
December 26, 2015 12:49
-
-
Save seburgi/7153920 to your computer and use it in GitHub Desktop.
example for async controller action with NServiceBus
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
[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