Views changes.
This commit is contained in:
parent
c5603b1ceb
commit
2fec7dfdf0
@ -1,5 +1,6 @@
|
||||
using ComputerStoreContracts.BindingModels;
|
||||
using ComputerStoreContracts.ViewModels;
|
||||
using ComputerStoreDataModels.Models;
|
||||
using ComputerStoreEmployeeApp.Models;
|
||||
using Microsoft.AspNetCore.Components;
|
||||
using Microsoft.AspNetCore.Mvc;
|
||||
@ -11,10 +12,14 @@ namespace ComputerStoreEmployeeApp.Controllers
|
||||
public class HomeController : Controller
|
||||
{
|
||||
private readonly ILogger<HomeController> _logger;
|
||||
private Dictionary<int, (IComponentModel, int)> _productComponents;
|
||||
private Dictionary<int, (IComponentModel, int)> _pcComponents;
|
||||
|
||||
public HomeController(ILogger<HomeController> logger)
|
||||
{
|
||||
_logger = logger;
|
||||
_productComponents = new Dictionary<int, (IComponentModel, int)>();
|
||||
_pcComponents = new Dictionary<int, (IComponentModel, int)>();
|
||||
}
|
||||
|
||||
public IActionResult Index()
|
||||
@ -159,11 +164,15 @@ namespace ComputerStoreEmployeeApp.Controllers
|
||||
}
|
||||
|
||||
[HttpPost]
|
||||
public void ProductAdd(string val)
|
||||
public void ProductAdd(string productname, double productprice)
|
||||
{
|
||||
|
||||
}
|
||||
|
||||
public double ProductComponents(int id)
|
||||
{
|
||||
var component = Task.Run(() => APIClient.GetRequest<ComponentViewModel>("api/main/getcomponent")).Result;
|
||||
}
|
||||
[HttpGet]
|
||||
public IActionResult ProductUpdate()
|
||||
{
|
||||
|
@ -14,4 +14,8 @@
|
||||
<input type="submit" id="componentbtn" value="ADD" class="btn btn-primary" />
|
||||
</div>
|
||||
</div>
|
||||
@if (!string.IsNullOrEmpty(ViewBag.Message))
|
||||
{
|
||||
<script>alert("@ViewBag.Message");</script>
|
||||
}
|
||||
</form>
|
@ -11,4 +11,8 @@
|
||||
<input type="submit" id="componentbtn" value="DELETE" class="btn btn-primary" />
|
||||
</div>
|
||||
</div>
|
||||
@if (!string.IsNullOrEmpty(ViewBag.Message))
|
||||
{
|
||||
<script>alert("@ViewBag.Message");</script>
|
||||
}
|
||||
</form>
|
@ -15,4 +15,8 @@
|
||||
<input type="submit" id="componentbtn" value="CHANGE" class="btn btn-primary" />
|
||||
</div>
|
||||
</div>
|
||||
@if (!string.IsNullOrEmpty(ViewBag.Message))
|
||||
{
|
||||
<script>alert("@ViewBag.Message");</script>
|
||||
}
|
||||
</form>
|
21
ComputerStoreEmployeeApp/Views/Home/ProductAdd.cshtml
Normal file
21
ComputerStoreEmployeeApp/Views/Home/ProductAdd.cshtml
Normal file
@ -0,0 +1,21 @@
|
||||
@{
|
||||
ViewData["Title"] = "Add a product";
|
||||
}
|
||||
<div class="text-center">
|
||||
<h2 class="display-4">Add a product</h2>
|
||||
</div>
|
||||
<form method="post">
|
||||
<div class="flex-container" style="flex-direction: row; justify-content: space-between; display: flex; height: 100vh;">
|
||||
<div class="flex-containerB1" style="flex-direction: column; flex: 4; gap: 20px; display: flex; align-items: center; justify-content: center;">
|
||||
<div class="productname" style="text-align: left; font-size: 15px;">Name:</div>
|
||||
<input type="text" id="productname" name="productname" />
|
||||
<div class="productprice" style="text-align: left; font-size: 15px;">Price:</div>
|
||||
<input type="text" id="productprice" name="productprice" />
|
||||
<input type="submit" id="productbtn" value="ADD" class="btn btn-primary" />
|
||||
</div>
|
||||
</div>
|
||||
@if (!string.IsNullOrEmpty(ViewBag.Message))
|
||||
{
|
||||
<script>alert("@ViewBag.Message");</script>
|
||||
}
|
||||
</form>
|
@ -7,38 +7,26 @@
|
||||
<div class="flex-containerA1" style="flex-direction: column; align-items: center; display: flex; gap: 35px">
|
||||
<h1>What do you want to do with products?</h1>
|
||||
<div class="flex-containerB1" style="display: flex; align-items: center; margin-top: 120px;">
|
||||
<input type="submit" id="productadd" value="ADD" class="btn btn-primary" style="font-size: 20pt; width: 130px;" />
|
||||
<form method="get" asp-controller="Home" asp-action="ProductAdd">
|
||||
<input type="submit" id="productadd" value="ADD" class="btn btn-primary" style="font-size: 20pt; width: 130px;" />
|
||||
</form>
|
||||
</div>
|
||||
|
||||
<div class="flex-containerB2" style="display: flex; align-items: center;">
|
||||
<input type="submit" id="productupdate" value="UPDATE" class="btn btn-primary" style="font-size: 20pt; width: 130px;" />
|
||||
<form method="get" asp-controller="Home" asp-action="ProductUpdate">
|
||||
<input type="submit" id="productupdate" value="UPDATE" class="btn btn-primary" style="font-size: 20pt; width: 130px;" />
|
||||
</form>
|
||||
</div>
|
||||
<div class="flex-containerB3" style="display: flex; align-items: center;">
|
||||
<input type="submit" id="productdel" value="DELETE" class="btn btn-primary" style="font-size: 20pt; width: 130px;" />
|
||||
<form method="get" asp-controller="Home" asp-action="ProductDelete">
|
||||
<input type="submit" id="productdel" value="DELETE" class="btn btn-primary" style="font-size: 20pt; width: 130px;" />
|
||||
</form>
|
||||
</div>
|
||||
<div class="flex-containerB3" style="display: flex; align-items: center;">
|
||||
<input type="submit" id="productcheck" value="STORAGE" class="btn btn-primary" style="font-size: 20pt; width: 130px;" />
|
||||
<form method="get" asp-controller="Home" asp-action="ProductCheck">
|
||||
<input type="submit" id="productcheck" value="STORAGE" class="btn btn-primary" style="font-size: 20pt; width: 130px;" />
|
||||
</form>
|
||||
</div>
|
||||
</div>
|
||||
</div>
|
||||
</form>
|
||||
<script>
|
||||
$('#productadd').on('click', function () {
|
||||
evt.preventDefault();
|
||||
document.location.href = '@Url.Action("ProductAdd","Home")';
|
||||
});
|
||||
$('#productupdate').on('click', function () {
|
||||
evt.preventDefault();
|
||||
document.location.href = '@Url.Action("ProductUpdate","Home")';
|
||||
});
|
||||
$('#productdel').on('click', function () {
|
||||
evt.preventDefault();
|
||||
document.location.href = '@Url.Action("ProductDelete","Home")';
|
||||
});
|
||||
$('#productcheck').on('click', function () {
|
||||
evt.preventDefault();
|
||||
document.location.href = '@Url.Action("ProductStorage","Home")';
|
||||
});
|
||||
|
||||
</script>
|
||||
</form>
|
||||
</div>
|
||||
|
Loading…
Reference in New Issue
Block a user