public async Task <IActionResult> ProcurarPorID([FromQuery] ProjetosPorID request) { try { var response = await _mediator.Send(request, CancellationToken.None); return(await ResponseQuerieAsync(response)); } catch (Exception ex) { return(BadRequest(ex.Message)); } }
public async Task <ResponseQueries> Handle(ProjetosPorID request, CancellationToken cancellationToken) { if (request == null) { return(new ResponseQueries(false, "Informe o ID do projeto", null)); } var projeto = await _consultaProjeto.ProcurarPorID(request.Id); if (projeto == null) { return(new ResponseQueries(false, "Nenhum projeto encontrado com o ID: " + request.Id, null)); } return(await ResponseHandlerBase.RetornoDaConsulta(true, "Projeto", projeto)); }