internal PurchasedCar ToPurchasedCar()
            {
                var tires = new TirePackage { Size = 16, Weight = 40 };
                var car = new PurchasedCar { CustomerName = "Me", Engine = GetEngine(), Tires = tires };

                return car;
            }
Esempio n. 2
0
        /// <summary>
        /// Create a new TirePackage object.
        /// </summary>
        /// <param name="id">Initial value of the Id property.</param>
        /// <param name="size">Initial value of the Size property.</param>
        /// <param name="weight">Initial value of the Weight property.</param>
        public static TirePackage CreateTirePackage(global::System.Int32 id, global::System.Int32 size, global::System.Int32 weight)
        {
            TirePackage tirePackage = new TirePackage();

            tirePackage.Id     = id;
            tirePackage.Size   = size;
            tirePackage.Weight = weight;
            return(tirePackage);
        }
Esempio n. 3
0
            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();
        }
Esempio n. 5
0
        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();
        }
Esempio n. 6
0
 /// <summary>
 /// Create a new TirePackage object.
 /// </summary>
 /// <param name="id">Initial value of the Id property.</param>
 /// <param name="size">Initial value of the Size property.</param>
 /// <param name="weight">Initial value of the Weight property.</param>
 public static TirePackage CreateTirePackage(global::System.Int32 id, global::System.Int32 size, global::System.Int32 weight)
 {
     TirePackage tirePackage = new TirePackage();
     tirePackage.Id = id;
     tirePackage.Size = size;
     tirePackage.Weight = weight;
     return tirePackage;
 }
Esempio n. 7
0
 /// <summary>
 /// Deprecated Method for adding a new object to the TirePackages EntitySet. Consider using the .Add method of the associated ObjectSet&lt;T&gt; property instead.
 /// </summary>
 public void AddToTirePackages(TirePackage tirePackage)
 {
     base.AddObject("TirePackages", tirePackage);
 }
Esempio n. 8
0
 /// <summary>
 /// Deprecated Method for adding a new object to the TirePackages EntitySet. Consider using the .Add method of the associated ObjectSet&lt;T&gt; property instead.
 /// </summary>
 public void AddToTirePackages(TirePackage tirePackage)
 {
     base.AddObject("TirePackages", tirePackage);
 }