namespace Dpz.Core.Web.Controllers
{
public class SteamController : Controller
{
private readonly ISteamGameService _steamGameService;
public SteamController(ISteamGameService steamGameService)
{
_steamGameService = steamGameService;
}
public async Task<IActionResult> Index()
{
this.SetTitle("我的Steam游戏");
var games = await _steamGameService.GetGamesAsync();
return View(games);
}
public async Task<IActionResult> Achievements(int? id = null)
{
if (id == null) return NotFound();
var model = await _steamGameService.GetGameAsync(id.Value);
if (model == null) return View(null);
var pageMetaPage = new VmPageMetadata
{
Description = "游戏成就:" + string.Join(",", model.Achievements.Select(x => x.DisplayName)),
Keywords = new() { $"{model.Name},{model.Name}游戏成就" },
Relations = new() { "Steam", "Achievements", id.ToString() }
};
ViewData["PageMetadata"] = pageMetaPage;
this.SetTitle($"{model.Name} 成就");
return View(model);
}
}
}