public IHttpActionResult PostVenda_PagamentoViewModel(Venda_PagamentoViewModel venda_PagamentoViewModel)
        {
            if (!ModelState.IsValid)
            {
                return(BadRequest(ModelState));
            }
            _venda_PagamentoAppService.Criar(venda_PagamentoViewModel);

            return(CreatedAtRoute("DefaultApi", new { id = venda_PagamentoViewModel.Id }, venda_PagamentoViewModel));
        }
Exemple #2
0
        private void AdicionaVenda_Pagamentos(Guid Id_Venda, ICollection <Venda_PagamentoViewModel> Venda_Pagamentos)
        {
            // Cria Venda_Pagamentos
            foreach (var venda_Pagamento in Venda_Pagamentos)
            {
                venda_Pagamento.Id_venda = Id_Venda;

                var venda_PagamentoCriado = _venda_PagamentoAppService.Criar(venda_Pagamento);

                if (venda_Pagamento.Venda_Pagamento_Fichas.Count > 0)
                {
                    //Cria Venda_Pagamento_Fichas
                    foreach (var venda_Pagamento_Ficha in venda_Pagamento.Venda_Pagamento_Fichas)
                    {
                        venda_Pagamento_Ficha.Id_Ficha = venda_Pagamento_Ficha.Ficha.Id.Value;

                        venda_Pagamento_Ficha.Id_Venda_Pagamento = venda_PagamentoCriado.Id;

                        _venda_Pagamento_FichaAppService.Criar(venda_Pagamento_Ficha);
                    }
                }
            }
        }