internal PurchasedCar ToPurchasedCar() { var tires = new TirePackage { Size = 16, Weight = 40 }; var car = new PurchasedCar { CustomerName = "Me", Engine = GetEngine(), Tires = tires }; return car; }
/// <summary> /// Create a new PurchasedCar object. /// </summary> /// <param name="id">Initial value of the Id property.</param> /// <param name="engineId">Initial value of the EngineId property.</param> /// <param name="tireId">Initial value of the TireId property.</param> public static PurchasedCar CreatePurchasedCar(global::System.Int32 id, global::System.Int32 engineId, global::System.Int32 tireId) { PurchasedCar purchasedCar = new PurchasedCar(); purchasedCar.Id = id; purchasedCar.EngineId = engineId; purchasedCar.TireId = tireId; return(purchasedCar); }
public void Purchase(Car car) { PurchasedCar purchasedCar = car.ToPurchasedCar(); var context = new Entities(); context.AddToPurchasedCars(purchasedCar); context.SaveChanges(); }
internal PurchasedCar ToPurchasedCar() { var tires = new TirePackage { Size = 16, Weight = 40 }; var car = new PurchasedCar { CustomerName = "Me", Engine = GetEngine(), Tires = tires }; return(car); }
public void PurchaseCar(CarType type) { var tires = new TirePackage {Size = 16, Weight = 40}; Engine engine = type == CarType.Basic ? new Engine {Cylinders = 4, Horsepower = 120} : new Engine {Cylinders = 8, Horsepower = 200}; var car = new PurchasedCar {CustomerName = "Me", Engine = engine, Tires = tires}; var context = new Entities(); context.AddToPurchasedCars(car); context.SaveChanges(); }
public void PurchaseCar(CarType type) { var tires = new TirePackage { Size = 16, Weight = 40 }; Engine engine = type == CarType.Basic ? new Engine { Cylinders = 4, Horsepower = 120 } : new Engine { Cylinders = 8, Horsepower = 200 }; var car = new PurchasedCar { CustomerName = "Me", Engine = engine, Tires = tires }; var context = new Entities(); context.AddToPurchasedCars(car); context.SaveChanges(); }
/// <summary> /// Create a new PurchasedCar object. /// </summary> /// <param name="id">Initial value of the Id property.</param> /// <param name="engineId">Initial value of the EngineId property.</param> /// <param name="tireId">Initial value of the TireId property.</param> public static PurchasedCar CreatePurchasedCar(global::System.Int32 id, global::System.Int32 engineId, global::System.Int32 tireId) { PurchasedCar purchasedCar = new PurchasedCar(); purchasedCar.Id = id; purchasedCar.EngineId = engineId; purchasedCar.TireId = tireId; return purchasedCar; }
/// <summary> /// Deprecated Method for adding a new object to the PurchasedCars EntitySet. Consider using the .Add method of the associated ObjectSet<T> property instead. /// </summary> public void AddToPurchasedCars(PurchasedCar purchasedCar) { base.AddObject("PurchasedCars", purchasedCar); }