ISEbd-21 Melnikov I. O. Lab Work 05 Advanced #31
@ -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()
|
||||
{
|
||||
|
@ -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>
|
@ -35,4 +35,7 @@
|
||||
else
|
||||
{
|
||||
<div>Магазинов нет</div>
|
||||
}
|
||||
}
|
||||
<form method="get">
|
||||
<button asp-controller="Home" asp-action="Create" class="btn btn-primary">Добавить магазин</button>
|
||||
</form>
|
Loading…
Reference in New Issue
Block a user