public ICommandResult Handle(MarkAsDoneCommand command) { command.Validate(); if (command.Invalid) { return(new GenericCommandResult(false, "Tarefa errada !", command.Notifications)); } var todo = _repository.GetById(command.Id, command.User); todo.MarkAsDone(); _repository.Update(todo); return(new GenericCommandResult(true, "Tarefa salva", command.Notifications)); }
public GenericCommandResult MarkAsDone([FromBody] MarkAsDoneCommand command, [FromServices] ToDoHandler handler) { command.User = "******"; return((GenericCommandResult)handler.Handle(command)); }