public static PlanoComercialViewModel From(PlanoComercial planoComercial, IRepositorioDePlanosComerciais repositorioDePlanosComerciais, IRepositorioDeModelos repositorioDeModelos)
        {
            var custos = planoComercial.Custos.Select(p => CustoViewModel.From(p)).ToList();

            var custosObservableCollection = new CustosObservableCollection(custos);

            var itensDePlanoComercial = planoComercial.Itens.Select(p => ItemDePlanoComercialViewModel.From(p, repositorioDePlanosComerciais, repositorioDeModelos)).ToList();

            var itensDePlanoComercialObservableCollection = new ItensDePlanoComercialObservableCollection(repositorioDePlanosComerciais, repositorioDeModelos);

            var viewModel = new PlanoComercialViewModel
            {
                model = planoComercial as PlanoComercial,
                //Id = planoComercial.Id,
                nome             = planoComercial.Nome,
                RendaBrutaMensal = planoComercial.RendaBrutaMensal,
                Custos           = custosObservableCollection,
                Itens            = itensDePlanoComercialObservableCollection
            };

            custosObservableCollection.planoComercial = viewModel;

            itensDePlanoComercialObservableCollection.planoComercial = viewModel;

            return(viewModel);
        }
        public static ItemDePlanoComercialViewModel From(ItemDePlanoComercial itemDePlanoComercial, IRepositorioDePlanosComerciais repositorioDePlanosComerciais, IRepositorioDeModelos repositorioDeModelos)
        {
            var modeloViewModel = ModeloViewModel.From(itemDePlanoComercial.Modelo);

            var viewModel = new ItemDePlanoComercialViewModel
            {
                itemDePlanoComercial          = itemDePlanoComercial,
                repositorioDePlanosComerciais = repositorioDePlanosComerciais,
                //PlanoComercialId = itemDePlanoComercial.PlanoComercial.Id,
                modeloViewModel = modeloViewModel,
                //ModeloCodigo = itemDePlanoComercial.Modelo.Codigo,
                //ModeloNome = itemDePlanoComercial.Modelo.Nome,
                //CustoDeProducaoSugerido = itemDePlanoComercial.CustoDeProducaoSugerido.ToString(),
                Margem                 = itemDePlanoComercial.Margem,
                margemPercentual       = itemDePlanoComercial.MargemPercentual.ToString(),
                taxaDeMarcacaoSugerida = (itemDePlanoComercial.TaxaDeMarcacaoSugerida.HasValue ? itemDePlanoComercial.TaxaDeMarcacaoSugerida.Value.ToString() : null),
                precoDeVendaDesejado   = (itemDePlanoComercial.PrecoDeVendaDesejado.HasValue ? itemDePlanoComercial.PrecoDeVendaDesejado.Value.ToString() : null),
            };

            return(viewModel);
        }