public ICommandResult Handler(MarkToDoAsUndoneCommand command) { command.Validate(); if (command.Invalid) { return(new GenericCommandResult(false, "ops, tem algo errado ai", command.Notifications)); } var todo = _repository.GetById(command.Id, command.User); todo.MarkAsUnDone(); _repository.Update(todo); return(new GenericCommandResult(true, "DONE!", command.Id)); }
public GenericCommandResult Update([FromBody] MarkToDoAsUndoneCommand commad, [FromServices] TodoHandler handler) { commad.User = User.Claims.FirstOrDefault(x => x.Type == "user_id")?.Value;; return((GenericCommandResult)handler.Handler(commad)); }