public async Task <ICollection <RouteLeg> > GetByRoute(int routeId, RouteLegKind kind) { if (!await RouteService.IsExist(routeId)) { throw new EntityNotFoundException($"RouteId:{routeId} doesn't exist.", "Route"); } return(await Repository.GetByRoute(routeId, kind)); }
public async Task <RouteLeg> Create(int routeId, RouteLegKind kind, int startAddressId, int endAddressId, int duration, int distance) { var leg = new RouteLeg { RouteId = routeId, Kind = kind, StartAddressId = startAddressId, EndAddressId = endAddressId, Duration = duration, Distance = distance }; await Verify(leg); await Repository.Add(leg); await Repository.Save(); return(leg); }
public async Task <ICollection <RouteLeg> > GetByRoute(int routeId, RouteLegKind kind) { return(await Entities.Where(l => l.RouteId.Equals(routeId) && l.Kind.Equals(kind)).ToListAsync()); }
public RouteLegAM GetLeg(RouteAM route, RouteLegKind legKind) { return(route.Legs.FirstOrDefault(l => l.Kind.Equals(RouteLegKind.Feed))); }