public async Task <Output <bool> > HandleAsync(UpdateToDoCommand command)
        {
            _argumentValidator.Validate(command);
            _argumentValidator.Validate(command.ToDoModel);
            var result = await _toDoRepository.UpdateAsync(command.ToDoModel.ToTableModel());

            return(new Output <bool>(result));
        }
Пример #2
0
        public async Task <Output <int> > HandleAsync(CreateToDoCommand command)
        {
            _argumentValidator.Validate(command);
            _argumentValidator.Validate(command.ToDoModel);

            var result = await _toDoRepository.AddAsync(command.ToDoModel.ToTableModel());

            var isSuccess = result > 0;

            return(new Output <int>(isSuccess, result));
        }
        public async Task <Output <bool> > HandleAsync(RemoveToDoCommand command)
        {
            _argumentValidator.Validate(command);
            var toDoItem = await _toDoRepository.GetByIdAsync(command.Id);

            if (toDoItem == null)
            {
                return(new Output <bool>(false));
            }
            var result = await _toDoRepository.RemoveAsync(toDoItem);

            return(new Output <bool>(result));
        }
Пример #4
0
 public StringBuilder ValidateArguments(string[] args)
 {
     return(argumentValidator.Validate(args));
 }