Exemple #1
0
        public static void Initialize(PLotContext context)
        {
            context.Database.EnsureCreated();

            if (context.ParkingType.Any())
            {
                return;
            }

            var standardType = new ParkingType {
                Description = "Standard"
            };
            var handicapType = new ParkingType {
                Description = "Handicap"
            };

            context.ParkingType.Add(standardType);
            context.ParkingType.Add(handicapType);
            context.SaveChanges();

            foreach (var i in Enumerable.Range(1, 24))
            {
                context.ParkingSpot.Add(new ParkingSpot {
                    Type = standardType
                });
            }

            context.SaveChanges();

            foreach (var i in Enumerable.Range(1, 6))
            {
                context.ParkingSpot.Add(new ParkingSpot {
                    Type = handicapType
                });
            }

            context.SaveChanges();
        }
 public ParkingTypesController(PLotContext context)
 {
     _context = context;
 }
 public OperatorController(PLotContext context)
 {
     _context = context;
 }
 public TicketsController(PLotContext context)
 {
     _context = context;
 }
 public HomeController(PLotContext context)
 {
     _context = context;
 }
 public VehiclesController(PLotContext context)
 {
     _context = context;
 }