public async Task <LocalAuthority> GetLocalAuthorityAsync(int laCode, DateTime date, CancellationToken cancellationToken) { var dateOfPreviousVersion = _localAuthorityIndex.GetDateOfMostRecentVersionBefore(laCode, date, cancellationToken); if (!dateOfPreviousVersion.HasValue) { return(null); } var fileName = $"localauthority-{laCode}-{dateOfPreviousVersion.Value:yyyyMMdd}.json"; var path = Path.Combine(_dataDirectory, fileName); var json = await FileHelper.ReadFileAsStringAsync(path); return(JsonConvert.DeserializeObject <LocalAuthority>(json)); }
public async Task <Group> GetGroupAsync(long uid, DateTime date, CancellationToken cancellationToken) { var dateOfPreviousVersion = _groupIndex.GetDateOfMostRecentVersionBefore(uid, date, cancellationToken); if (!dateOfPreviousVersion.HasValue) { return(null); } var fileName = $"group-{uid}-{dateOfPreviousVersion.Value:yyyyMMdd}.json"; var path = Path.Combine(_dataDirectory, fileName); var json = await FileHelper.ReadFileAsStringAsync(path); return(JsonConvert.DeserializeObject <Group>(json)); }