Newer
Older
using FitConnect.Models;
using FitConnect.Services;
using FitConnect.Services.Interfaces;
using Microsoft.Extensions.Logging;
namespace FitConnect;
public class Router : IRouter {
private IRouteService RouteService;
public Router(FitConnectEnvironment environment, ILogger logger = null) {
RouteService = new RouteService(environment.RoutingUrl, "v1", logger: logger);
}
public async Task<List<FitConnect.Services.Models.v1.Routes.Route>> FindDestinationsAsync(string leiaKey, string? ags = null,
string? ars = null,
string? areaId = null) => await RouteService.GetDestinationIdAsync(leiaKey, ags, ars, areaId);
/// <summary>
/// Finding Areas
/// </summary>
/// <param name="filter"></param>
/// <param name="totalCount"></param>
/// <param name="offset"></param>
/// <param name="limit"></param>
/// <returns></returns>
public IEnumerable<Area> GetAreas(string filter, out int totalCount, int offset = 0,
int limit = 100) {
var dto = RouteService.GetAreas(filter, offset, limit).Result;
totalCount = dto?.TotalCount ?? 0;
return dto?.Areas ?? new List<Area>();
}