ISEbd-21 Melnikov I. O. Lab Work 05 Advanced #31

Closed
Igor-Melnikov wants to merge 23 commits from lab5adv into lab5
3 changed files with 41 additions and 2 deletions
Showing only changes of commit 369a8a8bca - Show all commits

View File

@ -1,4 +1,5 @@
using BlacksmithWorkshopContracts.ViewModels;
using BlacksmithWorkshopContracts.BindingModels;
using BlacksmithWorkshopContracts.ViewModels;
using BlacksmithWorkshopStoreApp.Models;
using Microsoft.AspNetCore.Mvc;
using System.Diagnostics;
@ -40,6 +41,17 @@ namespace BlacksmithWorkshopStoreApp.Controllers
}
return Redirect("~/Home/Index");
}
[HttpGet]
public IActionResult Create()
{
return View();
}
[HttpPost]
public IActionResult Create(StoreBindingModel model)
{
APIClient.PostRequest("/api/store/createstore", model);
return Redirect("~/Home/Stores");
}
[ResponseCache(Duration = 0, Location = ResponseCacheLocation.None, NoStore = true)]
public IActionResult Error()
{

View File

@ -0,0 +1,24 @@
@{
ViewData["Title"] = "Создание магазина";
}
<form method="post">
<div class="row">
<div class="col-4">Название магазина:</div>
<div class="col-8"><input type="text" name="StoreName" /></div>
</div>
<div class="row">
<div class="col-4">Адрес:</div>
<div class="col-8"><input type="text" name="Address" /></div>
</div>
<div class="row">
<div class="col-4">Дата открытия:</div>
<div class="col-8"><input type="date" name="OpeningDate" /></div>
</div>
<div class="row">
<div class="col-4">Макс. изделий:</div>
<div class="col-8"><input type="text" name="MaxManufactures" /></div>
</div>
<div class="row">
<div><button asp-controller="Home" asp-action="Create" class="btn btn-primary">Добавить</button></div>
</div>
</form>

View File

@ -35,4 +35,7 @@
else
{
<div>Магазинов нет</div>
}
}
<form method="get">
<button asp-controller="Home" asp-action="Create" class="btn btn-primary">Добавить магазин</button>
</form>