public async Task <IActionResult> Get(QueryTrains.Request request) { if (request == null) { return(BadRequest($"{typeof(QueryTrains.Request)} is null")); } try { var session = _ssp.Create(TimeSpan.FromDays(1)); var result = await _rail.QueryTrainsAsync(session, request); await _ssp.SaveAsync(session); return(Ok(new GetTrainsResult { SessionId = session.Id, Trains = result.Trains })); } catch (Exception ex) { _logger.LogError(ex, "GetTrains failed"); return(StatusCode(500)); } }
public ISession GetActiveSession() { if (Current == null) { Current = _provider.Create(); } return(Current); }
public ISession GetActiveSession() { if (Current == null) { var session = _provider.Create(); Current = session; return(session); } return(Current); }