Ejemplo n.º 1
0
 public bool Update(Car car)
 {
     if (car == null)
     {
         throw new ArgumentNullException("Car cannot be null");
     }
     else
     {
         var result = db.Cars.SingleOrDefault(b => b.ID == car.ID);
         if (result != null)
         {
             result.CustomerID = car.CustomerID;
             //result.Customer = car.Customer;
             result.IsAvailable      = car.IsAvailable;
             result.Model            = car.Model;
             result.Price            = car.Price;
             result.TimeShouldReturn = car.TimeShouldReturn;
             db.SaveChanges();
             return(true);
         }
         return(false);
     }
 }
Ejemplo n.º 2
0
 public void AddCustomer(Customer customer)
 {
     db.Customers.Add(customer);
     db.SaveChanges();
 }