示例#1
0
        public override void Execute(object parameter)
        {
            var viewModelPrancha = parameter as PranchaViewModel;
            var prancha          = new ModelConcertosEntity.Prancha();
            PranchaController pranchaController = new PranchaController();

            pranchaController.ExcluirPrancha(viewModelPrancha.PranchaSelecionada.Id_Prancha);
            viewModelPrancha.Pranchas = pranchaController.GetPrancha();

            //var viewModel = (PranchaViewModel)parameter;
            //viewModel.Pranchas.Remove(viewModel.PranchaSelecionada);
            //viewModel.PranchaSelecionada = viewModel.Pranchas.FirstOrDefault();
        }
        public override void Execute(object parameter)
        {
            var viewModelPrancha = (PranchaViewModel)parameter;
            var prancha          = new ModelConcertosEntity.Prancha();

            var pw = new TelaAddPrancha();

            pw.DataContext = prancha;
            pw.ShowDialog();

            if (pw.DialogResult.HasValue && pw.DialogResult.Value)
            {
                PranchaController pranchaController = new PranchaController();
                pranchaController.InserirPrancha(prancha);
                viewModelPrancha.Pranchas = pranchaController.GetPrancha();
            }
        }
        public override void Execute(object parameter)
        {
            var viewModelPrancha = (PranchaViewModel)parameter;
            var clonePrancha     = (ModelConcertosEntity.Prancha)viewModelPrancha.PranchaSelecionada.Clone();
            var fw = new TelaAddPrancha();

            fw.DataContext = clonePrancha;
            fw.ShowDialog();

            if (fw.DialogResult.HasValue && fw.DialogResult.Value)
            {
                PranchaController pranchaController = new PranchaController();

                viewModelPrancha.PranchaSelecionada.Modelo     = clonePrancha.Modelo;
                viewModelPrancha.PranchaSelecionada.Marca      = clonePrancha.Marca;
                viewModelPrancha.PranchaSelecionada.Medida     = clonePrancha.Medida;
                viewModelPrancha.PranchaSelecionada.Cor        = clonePrancha.Cor;
                viewModelPrancha.PranchaSelecionada.QtdQuilhas = clonePrancha.QtdQuilhas;

                pranchaController.EditarPrancha(viewModelPrancha.PranchaSelecionada.Id_Prancha, viewModelPrancha.PranchaSelecionada);
            }
        }
示例#4
0
        public PranchaViewModel()
        {
            PranchaController pranchaController = new PranchaController();

            Pranchas = pranchaController.GetPrancha();
        }