public async Task <IActionResult> Post(Compra compra) { try { var result = await service.Post(compra); return(CreatedAtAction("Post", new { id = compra.IdCompra }, result)); } catch (Exception e) { var err = e.Message; return(BadRequest(new { msg = err })); } }