public dynamic Post([FromBody] Venda venda) { try { token = HttpContext.Request?.Headers["token"]; if (_APIBusiness.ValidarToken(token)) { return(Created("true", _vendaBusiness.CriarVenda(venda))); } else { return(Unauthorized()); } } catch (Exception e) { return(BadRequest(e.Message)); } }
public ActionResult FinalizarVenda(Cliente cliente) { if (HttpContext.Session.GetObject <VendaView>("VendaView") != null) { VendaView VendaView = HttpContext.Session.GetObject <VendaView>("VendaView"); VendaView.Venda.Cliente = _clienteBusiness.ObterCliente(cliente.Id); if (_vendaBusiness.CriarVenda(VendaView.Venda)) { HttpContext.Session.SetObject("VendaView", null); return(RedirectToAction("ImpressaoVenda")); } else { return(RedirectToAction("CriarVenda")); } } else { return(RedirectToAction("CriarVenda")); } }