Exemplo n.º 1
0
        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));
        }
Exemplo n.º 2
0
 public GenericCommandResult MarkAsDone([FromBody] MarkAsDoneCommand command,
                                        [FromServices] ToDoHandler handler)
 {
     command.User = "******";
     return((GenericCommandResult)handler.Handle(command));
 }