private void DeleteButton_Click(object sender, System.Windows.RoutedEventArgs e) { using (CarentContext db = new CarentContext()) { Rent rent = db.Rents.Find(RentId); db.Rents.Remove(rent); db.SaveChanges(); AdminRents ar = new AdminRents(); NavigationService.Navigate(ar); } }
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); }
private void DeleteEmployeeButton_Click(object sender, RoutedEventArgs e) { using (CarentContext db = new CarentContext()) { Employee employee = db.Employees.Find(CurrentId); db.Employees.Remove(employee); db.SaveChanges(); } AdminEmployees ae = new AdminEmployees(); NavigationService.Navigate(ae); }
private void EditEmployeeButton_Click(object sender, RoutedEventArgs e) { using (CarentContext db = new CarentContext()) { Employee employee = db.Employees.Find(CurrentId); employee.FIO = EmployeeFIOTextBox.Text; employee.Experience = int.Parse(EmployeeExpTextBox.Text); db.SaveChanges(); } AdminEmployees ae = new AdminEmployees(); NavigationService.Navigate(ae); }
private void AddEmployeeButton_Click(object sender, RoutedEventArgs e) { using (CarentContext db = new CarentContext()) { Employee employee = new Employee() { FIO = EmployeeFIOTextBox.Text, Experience = int.Parse(EmployeeExpTextBox.Text), }; db.Employees.Add(employee); db.SaveChanges(); } AdminEmployees ae = new AdminEmployees(); NavigationService.Navigate(ae); }
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); }
private void AddCarButton_Click(object sender, RoutedEventArgs e) { using (CarentContext db = new CarentContext()) { Car car = new Car() { Id = int.Parse(IdTextBox.Text), 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, }; db.Cars.Add(car); db.SaveChanges(); } }
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); }
private void TryToRegistrButton_Click(object sender, RoutedEventArgs e) { if (LogInTextBox.Text == "" || RegistrPasswordBox.Text == "" || TelephoneNumberTextBox.Text == "") { ErrorTextBox.Visibility = Visibility.Visible; } else { using (CarentContext db = new CarentContext()) { User user = new User { Login = LogInTextBox.Text, Password = RegistrPasswordBox.Text, TelephoneNumber = TelephoneNumberTextBox.Text, Status = "user" }; db.Users.Add(user); db.SaveChanges(); } AppWindow app = new AppWindow("user"); app.Show(); Application.Current.MainWindow.Close(); } }