You cannot select more than 25 topics Topics must start with a letter or number, can include dashes ('-') and can be up to 35 characters long.

46 lines
1.5 KiB
C#

using System;
using Expedience.Infrastructure.Models;
using Expedience.Web.Services;
using Microsoft.AspNetCore.Mvc.RazorPages;
namespace Expedience.Web.Pages
{
public class IndexModel : PageModel
{
private readonly IApiService _apiService;
public List<DutyCompletionRecord>? DutyCompletionRecords { get; private set; }
public List<DeepDungeonRecord>? DeepDungeonRecords { get; private set; }
public List<ContentTypeRecord>? TreasureHuntRecords { get; private set; }
public IndexModel(IApiService apiService)
{
_apiService = apiService;
}
public async Task OnGet(string? expac, CancellationToken cancellationToken)
{
if (expac == null) expac = "DT";
if (expac == "DeepDungeons")
{
DutyCompletionRecords = null;
TreasureHuntRecords = null;
DeepDungeonRecords = await _apiService.GetDeepDungeonRecordsAsync(cancellationToken);
}
else if (expac == "TreasureHunt")
{
TreasureHuntRecords = await _apiService.GetTreasureHuntRecordsAsync(cancellationToken);
DutyCompletionRecords = null;
DeepDungeonRecords = null;
}
else
{
TreasureHuntRecords = null;
DutyCompletionRecords = await _apiService.GetDutyCompletionRecordsAsync(expac, cancellationToken);
DeepDungeonRecords = null;
}
}
}
}