zhaw-dnet2/Tasks/Lab10/RankingService/RankingWebApp/Controllers/RankingController.cs

31 lines
922 B
C#

using Microsoft.AspNetCore.Mvc;
using RankingService;
using RankingWebApp.Models;
using System.Diagnostics;
namespace RankingWebApp.Controllers
{
public class RankingController : Controller
{
private readonly ILogger<RankingController> _logger;
private readonly RankingClient _client;
public RankingController(ILogger<RankingController> logger)
{
_logger = logger;
_client = new RankingClient("http://localhost:5072", new HttpClient());
}
public async Task<IActionResult> Index()
{
return View((await _client.RankingsAsync()).ToList());
}
[ResponseCache(Duration = 0, Location = ResponseCacheLocation.None, NoStore = true)]
public IActionResult Error()
{
return View(new ErrorViewModel { RequestId = Activity.Current?.Id ?? HttpContext.TraceIdentifier });
}
}
}