Esempio n. 1
0
 public static async Task SeedDb(ParkingRentDbContext parkingRentDbContext)
 {
     if (!parkingRentDbContext.TypeParking.Any())
     {
         var typeParking = new List <TypeParking>
         {
             new TypeParking {
                 Id = 1, Libelle = "Box"
             },
             new TypeParking {
                 Id = 2, Libelle = "Garage"
             },
             new TypeParking {
                 Id = 3, Libelle = "Place de parking"
             },
         };
         parkingRentDbContext.AddRange(typeParking);
         parkingRentDbContext.SaveChanges();
     }
     if (!parkingRentDbContext.TypeUser.Any())
     {
         var typeUser = new List <TypeUser>
         {
             new TypeUser {
                 Id = 1, Libelle = "Particulier"
             },
             new TypeUser {
                 Id = 2, Libelle = "Professionnel"
             }
         };
         parkingRentDbContext.AddRange(typeUser);
         parkingRentDbContext.SaveChanges();
     }
     if (!parkingRentDbContext.TypeUser.Any())
     {
         var typeVehicule = new List <TypeVehicule>
         {
             new TypeVehicule {
                 Id = 1, Libelle = "Camion"
             },
             new TypeVehicule {
                 Id = 2, Libelle = "Voiture"
             },
             new TypeVehicule {
                 Id = 3, Libelle = "Voiture sans permis"
             }
         };
         parkingRentDbContext.AddRange(typeVehicule);
         parkingRentDbContext.SaveChanges();
     }
 }
Esempio n. 2
0
 public ParkingsController(ParkingRentDbContext context, ApplicationDbContext applicationDbContext, UserManager <ApplicationUser> userManager)
 {
     _context = context;
     _applicationDbContext = applicationDbContext;
     _userManager          = userManager;
 }