diff --git a/PaydayFrontend/Controllers/HomeController.cs b/PaydayFrontend/Controllers/HomeController.cs index addcc02..c3e111f 100644 --- a/PaydayFrontend/Controllers/HomeController.cs +++ b/PaydayFrontend/Controllers/HomeController.cs @@ -1,5 +1,6 @@ using System.Diagnostics; using Microsoft.AspNetCore.Mvc; +using Newtonsoft.Json; using PaydayFrontend.Models; namespace PaydayFrontend.Controllers; @@ -13,9 +14,17 @@ public class HomeController : Controller _logger = logger; } - public IActionResult Index() + + public async Task Index() { - return View(); + using HttpClient client = new(); + + string json = await client.GetStringAsync( + "https://payday.zetcraft.ru/v1/public/university"); + + List universities = JsonConvert.DeserializeObject>(json); + + return View(universities); } public IActionResult SecondPage() diff --git a/PaydayFrontend/Models/UniversityViewModel.cs b/PaydayFrontend/Models/UniversityViewModel.cs new file mode 100644 index 0000000..cae939c --- /dev/null +++ b/PaydayFrontend/Models/UniversityViewModel.cs @@ -0,0 +1,10 @@ +namespace PaydayFrontend.Models; + +public class University +{ + public long Id { get; set; } + public string Name { get; set; } + public string FullName { get; set; } + public string ImageUrl { get; set; } + public long MinPlaceCost { get; set; } +} \ No newline at end of file diff --git a/PaydayFrontend/PaydayFrontend.csproj b/PaydayFrontend/PaydayFrontend.csproj index c0f1265..cc7a8df 100644 --- a/PaydayFrontend/PaydayFrontend.csproj +++ b/PaydayFrontend/PaydayFrontend.csproj @@ -18,6 +18,7 @@ + diff --git a/PaydayFrontend/Views/Home/Index.cshtml b/PaydayFrontend/Views/Home/Index.cshtml index c5fbf2b..1666d60 100644 --- a/PaydayFrontend/Views/Home/Index.cshtml +++ b/PaydayFrontend/Views/Home/Index.cshtml @@ -1,4 +1,6 @@ -@{ +@model List + +@{ ViewData["Title"] = "Home Page"; } @@ -8,46 +10,18 @@
search
-
- universe - ЮФУ от 135т руб -
-
- universe - КубГУ от 135т руб -
-
- universe - ВШЭ от 135т руб -
-
- universe - ЮФУ от 135т руб -
-
- universe - ЮФУ от 135т руб -
-
- universe - ЮФУ от 135т руб -
-
- universe - КубГУ от 135т руб -
-
- universe - ВШЭ от 135т руб -
-
- universe - ЮФУ от 135т руб -
-
- universe - ЮФУ от 135т руб -
+ @{ + foreach (var university in Model) + { +
+ universe + @university.Name @if (university.MinPlaceCost != 0) + { + от @university.MinPlaceCost тыс. руб + } +
+ } + } diff --git a/PaydayFrontend/Views/Shared/_Layout.cshtml b/PaydayFrontend/Views/Shared/_Layout.cshtml index d6e67cb..19e1e1b 100644 --- a/PaydayFrontend/Views/Shared/_Layout.cshtml +++ b/PaydayFrontend/Views/Shared/_Layout.cshtml @@ -11,7 +11,6 @@ @* *@ - @* *@ @* *@ diff --git a/PaydayFrontend/wwwroot/img/favicon.png b/PaydayFrontend/wwwroot/img/favicon.png new file mode 100644 index 0000000..4581a35 Binary files /dev/null and b/PaydayFrontend/wwwroot/img/favicon.png differ diff --git a/PaydayFrontend/wwwroot/img/icons/ufu.jpg b/PaydayFrontend/wwwroot/img/icons/ufu.jpg deleted file mode 100644 index 7d14da7..0000000 Binary files a/PaydayFrontend/wwwroot/img/icons/ufu.jpg and /dev/null differ