Instantly share code, notes, and snippets.

@vkhorikov vkhorikov/1.cs
Last active Jan 29, 2019

Embed
What would you like to do?
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