private void AddExterior(object sender, RoutedEventArgs e)
 {
     if (decimal.TryParse(ExteriorPrice.Text, out decimal Price))
     {
         ExteriorUI exteriorUI = new ExteriorUI()
         {
             Price = Price, Producer = ExteriorProducer.Text, Colour = ExteriorColour.Text, TypeOfPaint = ExteriorTypeOfPaint.Text
         };
         Methods.AddParts(exteriorUI);
     }
 }
Exemplo n.º 2
0
        public Exterior ConvertTOExterior(ExteriorUI exteriorUI)
        {
            Exterior exterior = new Exterior()
            {
                Id          = exteriorUI.Id,
                Colour      = exteriorUI.Colour,
                Price       = exteriorUI.Price,
                Producer    = exteriorUI.Producer,
                TypeOfPaint = exteriorUI.TypeOfPaint
            };

            return(exterior);
        }
        private void AddCar(object sender, RoutedEventArgs e)
        {
            decimal.TryParse(CarPrice.Text, out decimal price);
            string name = CarName.Text;

            if (CarEngine.SelectedIndex >= 0 && CarGearbox.SelectedIndex >= 0 && CarInterior.SelectedIndex >= 0 && CarExterior.SelectedIndex >= 0 && price >= 0)
            {
                EngineUI   engineUI   = CarEngine.SelectedItem as EngineUI;
                GearboxUI  gearboxUI  = CarGearbox.SelectedItem as GearboxUI;
                InteriorUI interiorUI = CarInterior.SelectedItem as InteriorUI;
                ExteriorUI exteriorUI = CarExterior.SelectedItem as ExteriorUI;
                CarUI      carUI      = new CarUI()
                {
                    Engine = engineUI, Exterior = exteriorUI, Gearbox = gearboxUI, Interior = interiorUI, Name = name, Price = price, Status = "Not Sold"
                };
                Methods.AddCar(carUI);
            }
        }