Skip to content

Instantly share code, notes, and snippets.

@vkhorikov
Last active January 29, 2019 17:37
Show Gist options
  • Star 0 You must be signed in to star a gist
  • Fork 0 You must be signed in to fork a gist
  • Save vkhorikov/02778357c8f13e28c53320008d8687e1 to your computer and use it in GitHub Desktop.
Save vkhorikov/02778357c8f13e28c53320008d8687e1 to your computer and use it in GitHub Desktop.
Are CQRS commands part of the domain model?
public IActionResult EditPersonalInfo([FromBody] EditPersonalInfoCommand command)
{
var handler = new EditPersonalInfoCommandHandler(_unitOfWork);
Result result = handler.Handle(command);
return result.IsSuccess ? Ok() : Error(result.Error);
}
public IActionResult EditPersonalInfo([FromBody] StudentPersonalInfoDto dto)
{
var command = new EditPersonalInfoCommand
{
Email = dto.Email, Name = dto.Name, Id = id
};
var handler = new EditPersonalInfoCommandHandler(_unitOfWork);
Result result = handler.Handle(command);
return result.IsSuccess ? Ok() : Error(result.Error);
}
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment