示例#1
0
        public async Task <Response> Handle(Request request, CancellationToken cancellationToken)
        {
            var instrutor = await _instrutorReadRepository.GetAsync(request.Id);

            if (instrutor == null)
            {
                var response = new Response();
                response.AddError($"Instrutor de id {request.Id} não encontrado");
                return(response);
            }

            _instrutorWriteRepository.Delete(instrutor);
            await _uow.CommitAsync();

            return(new Response(instrutor));
        }
        public async Task <IActionResult> GetAll()
        {
            var data = await _instrutorReadRepository.GetAsync();

            return(Ok(data));
        }