public async Task <IActionResult> GetById(int id) { try { if (!ModelState.IsValid) { throw new Exception("Petición inválida"); } return(Ok(await _paymentMethodService.GetByIdAsync(id, _apiDbContext))); } catch (Exception e) { return(StatusCode(500, e.Message)); } }