Exemplo n.º 1
0
 public void AddCar(CarSharing.Model.Car car)
 {
     car.CarMake    = car.CarMake1.IdMake;
     car.TypeOfCar  = car.TypeOfCar1.IdTypeOfCar;
     car.TypeEngine = car.TypeEngine1.IdEngine;
     car.CarColor   = car.CarColor1.IdColor;
     carShaeringEntities.Cars.Add(car);
     Model.SaveChanges();
 }
Exemplo n.º 2
0
 public void AddNewRent(CarSharing.Model.Car car, CarSharing.Model.City city, CarSharing.Model.User user)
 {
     CarSharing.Model.CarRental carRental = new CarSharing.Model.CarRental()
     {
         CarId         = car.IdCar,
         CityId        = city.IdCity,
         UserId        = user.IdUsers,
         DateTimeStart = DateTime.Now
     };
     carShaeringEntities.CarRentals.Add(carRental);
     Model.SaveChanges();
 }
 //set DataContext from Selected Row
 private void SelectCar(object sender, RoutedEventArgs routedEventArgs)
 {
     try
     {
         if (this.ListCars.SelectedItem != null)
         {
             this.SelectedCar = (Model.Car) this.ListCars.SelectedItem;
             this.DataContext = this.SelectedCar;
         }
     }
     catch (Exception ex)
     {
         SharedClass.MessageBoxError(ex);
     }
 }
Exemplo n.º 4
0
 public bool isSelected(CarSharing.Model.Car car)
 {
     return(car != null);
 }
Exemplo n.º 5
0
 public bool checkVIN(CarSharing.Model.Car car)
 {
     return(String.IsNullOrWhiteSpace(car.VIN));
 }
Exemplo n.º 6
0
 public void RemoveCar(CarSharing.Model.Car car)
 {
     carShaeringEntities.Cars.Remove(car);
     Model.SaveChanges();
 }