Ejemplo n.º 1
0
 public async void ClearRoutes()
 {
     foreach (var route in await _route.GetAll())
     {
         await _route.Delete(route.Id);
     }
 }
Ejemplo n.º 2
0
 public IEnumerable <Route> GetAllRoutes()
 {
     using (var context = new ConfigurationToolContext())
     {
         var repository = new RouteRepository(context);
         return(repository.GetAll());
     }
 }
Ejemplo n.º 3
0
        public async Task <RouteListTransactionResponse> Handle(RouteListTransactionRequest request, CancellationToken cancellationToken)
        {
            var Routes = await RouteRepository.GetAll(cancellationToken);

            RouteListTransactionResponse response = new RouteListTransactionResponse();

            response.RouteList =
                Routes.Select(x => Conversions.FromDTOToModel(x)).ToList();
            return(response);
        }
Ejemplo n.º 4
0
        public async Task <AllPathsTransactionResponse> Handle(AllPathsTransactionRequest request, CancellationToken cancellationToken)
        {
            var routes = await RouteRepository.GetAll(cancellationToken);

            ConfirmPoint(routes, request.PathModel);
            var fullPath = this.OriginalPoint.FindPaths(this.DestinationPoint);

            if (fullPath == null || fullPath.Count() == 0)
            {
                throw new NotFoundException("Path");
            }
            return(new AllPathsTransactionResponse()
            {
                FullPathList = fullPath.Select(x => Conversions.FromDomainPathToModel(x)).ToList()
            });
        }
Ejemplo n.º 5
0
        public async Task <CheapestPathTransactionResponse> Handle(CheapestPathTransactionRequest request, CancellationToken cancellationToken)
        {
            var routes = await RouteRepository.GetAll(cancellationToken);

            ConfirmPoint(routes, request.PathModel);
            var fullPath = this.OriginalPoint.FindShortestPath(this.DestinationPoint);

            if (fullPath == null)
            {
                throw new NotFoundException("Path");
            }
            return(new CheapestPathTransactionResponse()
            {
                FullPath = Conversions.FromDomainPathToModel(fullPath)
            });
        }
Ejemplo n.º 6
0
        public ActionResult Index()
        {
            var getList = Repo.GetAll();

            return(View(getList == null ? new List <Route>() : getList));
        }
 // GET api/server
 public IEnumerable <Route> Get()
 {
     return(db.GetAll());
 }