public IActionResult Latest() => new ContentResult { ContentType = "text/plain", Content = tzdbRepository.GetReleases().Last().NodaTimeOrgUrl, StatusCode = 200 };
public IActionResult Latest() { var download = tzdbRepository.GetReleases().First(); return(new ContentResult { ContentType = "text/plain", Content = GetDownloadUrl(download), StatusCode = 200 }); }
public IActionResult TimeZones(string?version = null, string?format = null) { var source = TzdbDateTimeZoneSource.Default; if (version != null) { var release = repository.GetRelease($"tzdb{version}.nzd"); if (release == null) { return(BadRequest("Unknown version")); } source = TzdbDateTimeZoneSource.FromStream(release.GetContent()); } var releaseModel = IanaRelease.FromTzdbDateTimeZoneSource(source); if (format == "json") { return(Json(releaseModel)); } var releases = repository.GetReleases() .Select(release => NzdNamePattern.Match(release.Name)) .Where(m => m.Success) .Select(m => m.Groups[1].Value) .ToList(); var model = (releases, releaseModel); return(View(model)); }