Esempio n. 1
0
 internal CarFactory(CarTypes model, CarSafety HighlySafe, string color, float price)
 {
     this.Model      = model;
     this.HighlySafe = HighlySafe;
     this.Color      = color;
     this.price      = price;
 }
Esempio n. 2
0
        public async Task <string> CreateAsync(string carId, string safetyId)
        {
            var carSafety = new CarSafety
            {
                CarId    = carId,
                SafetyId = safetyId,
            };

            await this.dbContext.CarSafeties.AddAsync(carSafety);

            await this.dbContext.SaveChangesAsync();

            return(carSafety.Id);
        }
Esempio n. 3
0
        public static CarFactory CreateCar(CarTypes model, CarSafety HighlySafe, string color, float price)
        {
            CarFactory newCar = null;

            switch (HighlySafe)
            {
            case CarSafety.FirstSafe:
                newCar = new CarFactory(model, HighlySafe, color, 75000);
                break;

            case CarSafety.SecondSafe:
                newCar = new CarFactory(model, HighlySafe, color, 85000);
                break;
            }

            Console.WriteLine("Car was created:\n Model: {0}\nSafety: {1}\nHas {2} Safety\nPrice:{3}\n*************************\n\n", newCar.Model, newCar.HighlySafe, newCar.Price);

            return(newCar);
        }