public VendaDomain CriarParaSalvar(VendaDto vendaDto) { var venda = new VendaBuilder() .WithId(Guid.NewGuid()) .WithCliente(vendaDto.Cliente) .WithClienteId(vendaDto.ClienteId) .WithFormaDePagamento(vendaDto.FormaDePagamento) .WithFormaDePagamentoId(vendaDto.FormaDePagamentoId) .WithUsuario(vendaDto.Usuario) .WithUsuarioId(vendaDto.UsuarioId) .WithValorTotal(vendaDto.ValorTotal) .Build(); return(venda); }
public VendaDomain CriarParaAlterar(VendaDto vendaDto) { var _venda = Context.Vendas.FirstOrDefault(x => x.Id == vendaDto.Id); if (_venda == null) { throw new ArgumentNullException(nameof(_venda)); } var venda = new VendaBuilder() .WithId(_venda.Id) .WithCliente(_venda.Cliente) .WithClienteId(_venda.ClienteId) .WithFormaDePagamento(_venda.FormaDePagamento) .WithFormaDePagamentoId(_venda.FormaDePagamentoId) .WithUsuario(_venda.Usuario) .WithUsuarioId(_venda.UsuarioId) .WithValorTotal(_venda.ValorTotal) .Build(); return(venda); }