lab-5-hard preparing for pr

This commit is contained in:
Zakharov_Rostislav 2024-04-28 23:27:22 +04:00
parent 9bda41c11f
commit caaf612951
3 changed files with 7 additions and 8 deletions

View File

@ -15,7 +15,7 @@ namespace BlacksmithWorkshopShopApp
_client.BaseAddress = new Uri(configuration["IPAddress"]);
_client.DefaultRequestHeaders.Accept.Clear();
_client.DefaultRequestHeaders.Accept.Add(new
MediaTypeWithQualityHeaderValue("application/json"));
MediaTypeWithQualityHeaderValue("application/json"));
}
public static T? GetRequest<T>(string requestUrl)
{

View File

@ -20,8 +20,7 @@ namespace BlacksmithWorkshopShopApp.Controllers
{
return Redirect("~/Home/Enter");
}
return
View(ApiClient.GetRequest<List<ShopViewModel>>($"api/shop/getshops"));
return View(ApiClient.GetRequest<List<ShopViewModel>>($"api/shop/getshops"));
}
[HttpGet]
@ -147,10 +146,10 @@ namespace BlacksmithWorkshopShopApp.Controllers
result.Item1.ShopManufactures.Clear();
for (int i = 0; i < result.Item2.Count; i++)
{
var icecream = result.Item2[i].Item1;
var manufacture = result.Item2[i].Item1;
var count = result.Item2[i].Item2;
table += "<tr>";
table += $"<td>{icecream}</td>";
table += $"<td>{manufacture}</td>";
table += $"<td>{count}</td>";
table += "</tr>";
}
@ -167,7 +166,7 @@ namespace BlacksmithWorkshopShopApp.Controllers
return View();
}
[HttpPost]
public void MakeSupply(int shop, int icecream, int count)
public void MakeSupply(int shop, int manufacture, int count)
{
if (ApiClient.Access == false)
{
@ -175,7 +174,7 @@ namespace BlacksmithWorkshopShopApp.Controllers
}
ApiClient.PostRequest("api/shop/makesupply", Tuple.Create(
new ShopSearchModel() { Id = shop },
new ManufactureViewModel() { Id = icecream },
new ManufactureViewModel() { Id = manufacture },
count
));
Response.Redirect("Index");

View File

@ -20,7 +20,7 @@
<div class="row">
<div class="col-4">Кузнечное изделие:</div>
<div class="col-8">
<select id="icecream" name="icecream" class="form-control" asp-items="@(new SelectList(@ViewBag.ListManufacture, "Id", "ManufactureName"))"></select>
<select id="manufacture" name="manufacture" class="form-control" asp-items="@(new SelectList(@ViewBag.ListManufacture, "Id", "ManufactureName"))"></select>
</div>
</div>
<div class="row">