50 lines
1.2 KiB
C#
50 lines
1.2 KiB
C#
using System.Diagnostics;
|
|
using Microsoft.AspNetCore.Mvc;
|
|
using Newtonsoft.Json;
|
|
using PaydayFrontend.Models;
|
|
|
|
namespace PaydayFrontend.Controllers;
|
|
|
|
public class HomeController : Controller
|
|
{
|
|
private readonly ILogger<HomeController> _logger;
|
|
|
|
public HomeController(ILogger<HomeController> logger)
|
|
{
|
|
_logger = logger;
|
|
}
|
|
|
|
|
|
public async Task<IActionResult> Index()
|
|
{
|
|
using HttpClient client = new();
|
|
|
|
string json = await client.GetStringAsync(
|
|
"https://payday.zetcraft.ru/v1/public/university");
|
|
|
|
List<University> universities = JsonConvert.DeserializeObject<List<University>>(json);
|
|
|
|
return View(universities);
|
|
}
|
|
|
|
public IActionResult SecondPage()
|
|
{
|
|
return View();
|
|
}
|
|
|
|
public IActionResult ThirdPage()
|
|
{
|
|
return View();
|
|
}
|
|
|
|
public IActionResult Privacy()
|
|
{
|
|
return View();
|
|
}
|
|
|
|
[ResponseCache(Duration = 0, Location = ResponseCacheLocation.None, NoStore = true)]
|
|
public IActionResult Error()
|
|
{
|
|
return View(new ErrorViewModel { RequestId = Activity.Current?.Id ?? HttpContext.TraceIdentifier });
|
|
}
|
|
} |