Beispiel #1
0
        public async Task <IActionResult> Desconto([FromServices] IVendaService service, [FromBody] DescontoRequest req)
        {
            var tsc = new TaskCompletionSource <IActionResult>();

            try
            {
                service.DarDesconto(req.VendaId, req.Valor);


                tsc.SetResult(RetornoHelper.CreateResponse("OK", 200));
            }
            catch (Exception e)
            {
                tsc.SetResult(RetornoHelper.CreateResponse(e.Message, 500));
            }
            return(await tsc.Task);
        }