Skip to content

Instantly share code, notes, and snippets.

@AlexArchive
Last active August 29, 2015 14:11
Show Gist options
  • Save AlexArchive/4f9ad79e9083f23bf63f to your computer and use it in GitHub Desktop.
Save AlexArchive/4f9ad79e9083f23bf63f to your computer and use it in GitHub Desktop.
public ActionResult AddPost(PostCommand command)
{
var response = mediator.Send(command);
if (response.Success) {
return RedirectToAction("Index", "Post", new { slug = response.Data.Slug });
}
ModelState.AddModelError("", response.Message)
return View(command);
}
IMediator broker;
public ActionResult AddPost(PostCommand command)
{
var response = broker.Send(command);
if (response.Successful)
{
var postSlug = response.Data;
}
ModelState.AddModelError("", "Slug occupied");
return View("", command);
}
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment