public BikeController(RentBikeContext rentBikeContext)
        {
            rentBikeDb = rentBikeContext;

            if (!rentBikeDb.BikeBases.Any())
            {
                rentBikeDb.BikeBases.Add(new BikeBase {
                    Name = "Test Bike", TypeBike = "Custom", RentPrice = 12
                });
                rentBikeDb.BikeBases.Add(new BikeBase {
                    Name = "Test", TypeBike = "Custom", RentPrice = 5
                });
                rentBikeDb.BikeBases.Add(new BikeBase {
                    Name = "Bike", TypeBike = "Custom", RentPrice = 13
                });

                rentBikeDb.SaveChanges();
            }
        }
Пример #2
0
 RentBikeContext context = null;                   //zmienna typu RentBikeContext
 public DBManager(RentBikeContext rentBikeContext) //kontruktor
 {
     this.context = rentBikeContext;
 }