Exemplo n.º 1
0
        public async Task <Unit> Handle(TaskDeleteCommand request, CancellationToken cancellationToken)
        {
            var task = _repository.GetTaskById(request.Id);

            if (task == null)
            {
                throw new System.ArgumentNullException("Task");
            }
            await Task.Run(() => { _repository.DeleteTask(task); });

            _logger.LogInformation($"TodoTask deleted {task.ToString()}");
            return(Unit.Value);
        }