public IActionResult GetPath([FromRoute] int id) { try { Path path = _pathRepository.GetById(id); if (path == null) { return(NotFound()); } else { return(Ok(path)); } } catch (Exception ex) { return(BadRequest(ex.Message)); } }
private List <Route> BuildRutes() { List <Route> routes = _routeRepository?.GetAll().ToList(); routes?.ForEach(route => { Path path = _pathRepository.GetById(route.PathId); path.Origin = _pointRepository.GetById(path.OriginId); path.Destiny = _pointRepository.GetById(path.DestinyId); route.Path = path; }); return(routes); }