public async Task <IActionResult> OnGetAsync() { var(stringId, _) = await _settingsSvc.GetAppSetting(AppSettingsKey.ImportantDaysScopeId); var range = await _settingsSvc.GetAppSettingInt(AppSettingsKey.ImportantDaysDisplayRange); if (!Guid.TryParse(stringId, out _) || range == null) { return(Redirect("~/Dates/Setup")); } Dates = await _datesService.GetDatesFromRange(Today, true); return(Page()); }
public async Task <ActionResult <List <DateListItemDto> > > GetDatesRange([FromQuery] bool withEmptyDates = true) { var records = await _datesService.GetDatesFromRange(DateOnly.FromDateTime(DateTime.UtcNow), withEmptyDates); var dto = records.Select(d => new DateListItemDto { Id = d.Id, Date = d.Date, TransferredDate = d.TransferredDate, TransferredDateStr = d.TransferredDate.ToString("yyyy.MM.dd ddd", CultureInfo.CurrentCulture), Name = d.Name, Text = d.Text, Themes = d.Themes }) .ToList(); return(Ok(dto)); }