фиксы по созданию магазина

This commit is contained in:
Мк Игорь 2023-06-12 00:42:14 +04:00
parent 82f8a241d6
commit 369a8a8bca
3 changed files with 41 additions and 2 deletions

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>