Last active
August 29, 2015 14:11
-
-
Save AlexArchive/4f9ad79e9083f23bf63f to your computer and use it in GitHub Desktop.
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
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); | |
} | |
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
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