public ICommandResult Handle(MarkAsUndoneCommand command) { command.Validate(); if (!command.Valid) { return(new GenericCommandResult(false, "Houve um erro na solicitação", command.Notifications)); } TodoItem item = _repository.GetByIdAndUser(command.Id, command.User); item.MarkAsUndone(); _repository.Update(item); return(new GenericCommandResult(true, "certo", item)); }
public ICommandResult Handle(MarkAsUndoneCommand command) { command.Validate(); if (command.Invalid) { return(new GenericCommandResult(false, "Tarefa errada !", command.Notifications)); } var todo = _repository.GetById(command.Id, command.User); todo.MarkAsUnDone(); _repository.Update(todo); return(new GenericCommandResult(true, "Tarefa salva", command.Notifications)); }