Esempio n. 1
0
 public CreateBusStopOnRouteResponse CreateBusStopOnRoute(BusStopOnRouteModel busStopOnRouteModel)
 {
     return(ExecuteAction <CreateBusStopOnRouteResponse>(r =>
     {
         var busStopOnRoute = new BusStopOnRoute()
         {
             Id = busStopOnRouteModel.Id,
             RouteId = busStopOnRouteModel.RouteId,
             BusStopId = busStopOnRouteModel.BusStopId,
             PreviousBusStopOnRouteId = busStopOnRouteModel.PreviousBusStopOnRouteId
         };
         _dbContext.BusStopsOnRoute.Add(busStopOnRoute);
         _dbContext.SaveChanges();
         r.Id = busStopOnRoute.Id;
     }));
 }
Esempio n. 2
0
 public BusStopOnRouteModel(BusStopOnRoute busStopOnRoute)
 {
     if (busStopOnRoute == null)
     {
         Id        = busStopOnRoute.Id;
         RouteId   = busStopOnRoute.RouteId;
         BusStopId = busStopOnRoute.BusStopId;
         PreviousBusStopOnRouteId = busStopOnRoute.PreviousBusStopOnRouteId;
         Route   = new RouteModel(busStopOnRoute.Route);
         BusStop = new BusStopModel(busStopOnRoute.BusStop);
         PreviousBusStopOnRoute = new BusStopOnRouteModel(busStopOnRoute.PreviousBusStopOnRoute);
         NextBusStopOnRoute     = new BusStopOnRouteModel(busStopOnRoute.NextBusStopOnRoute);
         if (busStopOnRoute.Arrivals != null && busStopOnRoute.Arrivals.Any())
         {
             Arrivals = busStopOnRoute.Arrivals.Select(a =>
             {
                 return(new ArrivalModel(a));
             }).ToList();
         }
     }
 }