Exemplo n.º 1
0
        private static void AddBusStopsToBus(TravelActiveContext context, Bus bus, Dictionary <string, BusStop> busStops, List <string> busStopsStrings)
        {
            for (int i = 0; i < busStopsStrings.Count; i++)
            {
                var         s           = busStopsStrings[i];
                StopOrdered stopOrdered = new StopOrdered();
                stopOrdered.BusId     = bus.Id;
                stopOrdered.BusStopId = busStops[s].Id;
                context.StopsOrdered.Add(stopOrdered);

                context.SaveChanges();
            }
            for (int i = 0; i < busStopsStrings.Count - 1; i++)
            {
                var s = busStopsStrings[i];
                for (int j = i + 1; j < busStopsStrings.Count; j++)
                {
                    var ds = busStopsStrings[j];
                    StopAccessibility stopAccessibility = new StopAccessibility();
                    stopAccessibility.BusId         = bus.Id;
                    stopAccessibility.InitialStopId = busStops[s].Id;
                    stopAccessibility.DestStopId    = busStops[ds].Id;
                    context.StopsAccessibility.Add(stopAccessibility);
                }
            }
            context.SaveChanges();
        }
Exemplo n.º 2
0
 public TokenService(TravelActiveContext context, IOptions <JwtSettings> jwtSettings) : base(context)
 {
     this.jwtSettings = jwtSettings.Value;
 }
Exemplo n.º 3
0
 public UserService(TravelActiveContext context, IMapper mapper, UserManager <User> userManager) : base(context)
 {
     this.mapper      = mapper;
     this.userManager = userManager;
 }
Exemplo n.º 4
0
 public BusService(TravelActiveContext context, IMapper mapper) : base(context)
 {
     this.mapper = mapper;
 }
Exemplo n.º 5
0
 public RidesService(TravelActiveContext context) : base(context)
 {
 }
 public BicycleDirectionsService(TravelActiveContext context, IMapper mapper, IOptions <ApiOptions> options) : base(context, mapper, options)
 {
 }
Exemplo n.º 7
0
 public static void Initialize(TravelActiveContext context)
 {
     ListStopAccessibilities = context.StopsAccessibility.ToList();
     ListStopOrdered         = context.StopsOrdered.Include(x => x.BusStop).ToList();
 }
Exemplo n.º 8
0
 protected Service(TravelActiveContext context)
 {
     this.Context = context;
 }
Exemplo n.º 9
0
 protected DirectionsService(TravelActiveContext context, IMapper mapper, IOptions <ApiOptions> apiOptions) : base(context)
 {
     this.mapper     = mapper;
     this.apiOptions = apiOptions.Value;
 }
Exemplo n.º 10
0
 public QrCodeService(TravelActiveContext context, IHostingEnvironment env) : base(context)
 {
     this.env = env;
 }