Exemplo n.º 1
0
        public async Task <ValidationResult> Handle(RemoveTodoAppCommand message, CancellationToken cancellationToken)
        {
            if (!message.IsValid())
            {
                return(message.ValidationResult);
            }

            var todoApp = await _todoAppRepository.GetById(message.Id);

            if (todoApp is null)
            {
                AddError("The todoApp doesn't exists.");
                return(ValidationResult);
            }
            _todoAppRepository.Remove(todoApp);

            return(await Commit(_todoAppRepository.UnitOfWork));
        }
Exemplo n.º 2
0
 public async Task <TodoAppViewModel> GetById(Guid id)
 {
     return(_mapper.Map <TodoAppViewModel>(await _todoAppRepository.GetById(id)));
 }