вывод списка магазинов
This commit is contained in:
parent
532853d3c3
commit
82f8a241d6
@ -10,4 +10,8 @@
|
||||
<PackageReference Include="Newtonsoft.Json" Version="13.0.3" />
|
||||
</ItemGroup>
|
||||
|
||||
<ItemGroup>
|
||||
<ProjectReference Include="..\BlacksmithWorkshopContracts\BlacksmithWorkshopContracts.csproj" />
|
||||
</ItemGroup>
|
||||
|
||||
</Project>
|
||||
|
@ -1,4 +1,5 @@
|
||||
using BlacksmithWorkshopStoreApp.Models;
|
||||
using BlacksmithWorkshopContracts.ViewModels;
|
||||
using BlacksmithWorkshopStoreApp.Models;
|
||||
using Microsoft.AspNetCore.Mvc;
|
||||
using System.Diagnostics;
|
||||
|
||||
@ -18,6 +19,7 @@ namespace BlacksmithWorkshopStoreApp.Controllers
|
||||
{
|
||||
return Redirect("~/Home/Enter");
|
||||
}
|
||||
ViewBag.Stores = APIClient.GetRequest<List<StoreViewModel>>("/api/store/getstores");
|
||||
return View();
|
||||
}
|
||||
[HttpGet]
|
||||
|
@ -1,8 +1,38 @@
|
||||
@{
|
||||
ViewData["Title"] = "Home Page";
|
||||
ViewData["Title"] = "Магазины";
|
||||
}
|
||||
|
||||
<div class="text-center">
|
||||
<h1 class="display-4">Welcome</h1>
|
||||
<p>Learn about <a href="https://docs.microsoft.com/aspnet/core">building Web apps with ASP.NET Core</a>.</p>
|
||||
<h1 class="display-4">Список магазинов</h1>
|
||||
</div>
|
||||
@if (ViewBag.Stores.Count != 0)
|
||||
{
|
||||
<table>
|
||||
<thead>
|
||||
<tr>
|
||||
<th>Название</th>
|
||||
<th>Адрес</th>
|
||||
<th>Дата открытия</th>
|
||||
<th>Макс. изделий</th>
|
||||
</tr>
|
||||
</thead>
|
||||
<tbody>
|
||||
@foreach (var store in ViewBag.Stores)
|
||||
{
|
||||
<tr>
|
||||
<td>@store.StoreName</td>
|
||||
<td>@store.Address</td>
|
||||
<td>@store.OpeningDate</td>
|
||||
<td>@store.MaxManufactures</td>
|
||||
<td><a href="">Изменить</a></td>
|
||||
<td><a href="">Удалить</a></td>
|
||||
<td><a href="">Поставить изделие</a></td>
|
||||
</tr>
|
||||
}
|
||||
</tbody>
|
||||
</table>
|
||||
}
|
||||
else
|
||||
{
|
||||
<div>Магазинов нет</div>
|
||||
}
|
@ -20,7 +20,7 @@
|
||||
<div class="navbar-collapse collapse d-sm-inline-flex justify-content-between">
|
||||
<ul class="navbar-nav flex-grow-1">
|
||||
<li class="nav-item">
|
||||
<a class="nav-link text-dark" asp-area="" asp-controller="Home" asp-action="Index">Главная</a>
|
||||
<a class="nav-link text-dark" asp-area="" asp-controller="Home" asp-action="Index">Список магазинов</a>
|
||||
</li>
|
||||
<li class="nav-item">
|
||||
<a class="nav-link text-dark" asp-area="" asp-controller="Home" asp-action="Enter">Вход</a>
|
||||
|
Loading…
Reference in New Issue
Block a user