コード例 #1
0
        private void DeleteCatButton_Click(object sender, RoutedEventArgs e)
        {
            using (CarentContext db = new CarentContext())
            {
                Car car = db.Cars.Find(CurrentId);
                db.Cars.Remove(car);
                db.SaveChanges();
            }
            AdminCars ac = new AdminCars();

            NavigationService.Navigate(ac);
        }
コード例 #2
0
        private void EditCarButton_Click(object sender, RoutedEventArgs e)
        {
            using (CarentContext db = new CarentContext())
            {
                Car car = db.Cars.Find(CurrentId);
                car.Automaker      = AutomakerTextBox.Text;
                car.Model          = ModelTextBox.Text;
                car.Price          = int.Parse(PriceTextBox.Text);
                car.Year           = int.Parse(YearTextBox.Text);
                car.Transmission   = TransmissionTextBox.Text;
                car.EngineCapacity = int.Parse(EngineCapacityTextBox.Text);
                car.Consumption    = ConsumptionTextBox.Text;
                car.Image          = ImageTextBox.Text;
                db.SaveChanges();
            }
            AdminCars ac = new AdminCars();

            NavigationService.Navigate(ac);
        }
コード例 #3
0
ファイル: AddCar.xaml.cs プロジェクト: LeMa7/CourseWork
        private void AddCarButton_Click(object sender, RoutedEventArgs e)
        {
            using (CarentContext db = new CarentContext())
            {
                Car car = new Car()
                {
                    Automaker      = AutomakerTextBox.Text,
                    Model          = ModelTextBox.Text,
                    Price          = int.Parse(PriceTextBox.Text),
                    Year           = int.Parse(YearTextBox.Text),
                    Transmission   = TransmissionTextBox.Text,
                    EngineCapacity = int.Parse(EngineCapacityTextBox.Text),
                    Consumption    = ConsumptionTextBox.Text,
                    Image          = ImageTextBox.Text,
                    Class          = ClassTextBox.Text
                };
                db.Cars.Add(car);
                db.SaveChanges();
            }
            AdminCars ac = new AdminCars();

            NavigationService.Navigate(ac);
        }
コード例 #4
0
ファイル: AdminPage.xaml.cs プロジェクト: LeMa7/CourseWork
        private void AdminCars_Click(object sender, RoutedEventArgs e)
        {
            AdminCars ac = new AdminCars();

            NavigationService.Navigate(ac);
        }