фронт вроде готов

This commit is contained in:
Николай 2023-04-04 13:29:56 +04:00
parent d3b137fbdb
commit 1ea5be4788
12 changed files with 66 additions and 94 deletions

View File

@ -28,15 +28,7 @@ namespace HardwareShopWorkerApp.Controllers
{ {
throw new Exception("Введите логин, email, пароль и роль"); throw new Exception("Введите логин, email, пароль и роль");
} }
APIClient.PostRequest("api/client/register", new UserBindingModel
{
Login = login,
Email = email,
Password = password,
Role = (UserRole)role
});
Response.Redirect("Enter"); Response.Redirect("Enter");
return;
} }
public IActionResult Index() public IActionResult Index()
@ -61,18 +53,70 @@ namespace HardwareShopWorkerApp.Controllers
} }
[HttpPost] [HttpPost]
public IActionResult Enter(string email, string password) public void Enter(string email, string password)
{ {
if (string.IsNullOrEmpty(email) || string.IsNullOrEmpty(password)) if (string.IsNullOrEmpty(email) || string.IsNullOrEmpty(password))
{ {
throw new Exception("Введите почту и пароль"); throw new Exception("Введите почту и пароль");
} }
APIClient.User = APIClient.GetRequest<UserViewModel>($"api/client/login?email={email}&password={password}"); Response.Redirect("MainWorker");
if (APIClient.User == null) }
public IActionResult MainWorker()
{ {
throw new Exception("Неверные почта и/или пароль"); return View();
} }
return RedirectToAction("MainWorker", "Worker");
public IActionResult Comments()
{
return View();
}
public IActionResult listComponents()
{
return View();
}
[HttpGet]
public IActionResult Purchases()
{
return View();
}
[HttpPost]
public void Purchases(int id)
{
Response.Redirect("Purchase");
}
[HttpGet]
public IActionResult Purchase()
{
return View();
}
public IActionResult WorkerReport()
{
return View();
}
[HttpGet]
public IActionResult Builds()
{
return View();
}
[HttpPost]
public void Builds(int id)
{
Response.Redirect("LinkPurchase");
}
[HttpGet]
public IActionResult LinkPurchase()
{
return View();
} }
} }
} }

View File

@ -1,72 +0,0 @@
using Microsoft.AspNetCore.Mvc;
namespace HardwareShopWorkerApp.Controllers
{
public class WorkerController : Controller
{
private readonly ILogger<WorkerController> _logger;
public WorkerController(ILogger<WorkerController> logger)
{
_logger = logger;
}
public IActionResult Comments()
{
return View();
}
public IActionResult listComponents()
{
return View();
}
public IActionResult MainWorker()
{
return View();
}
[HttpGet]
public IActionResult Purchases()
{
return View();
}
[HttpPost]
public void Purchases(int id)
{
Response.Redirect("Purchase");
}
[HttpGet]
public IActionResult Purchase()
{
return View();
}
public IActionResult WorkerReport()
{
return View();
}
[HttpGet]
public IActionResult Builds()
{
return View();
}
[HttpPost]
public void Builds(int id)
{
Response.Redirect("LinkPurchase");
}
[HttpGet]
public IActionResult LinkPurchase()
{
return View();
}
}
}

View File

@ -19,7 +19,7 @@
<a class="nav-link text-dark" asp-area="" asp-controller="Home" asp-action="Register">Регистрация</a> <a class="nav-link text-dark" asp-area="" asp-controller="Home" asp-action="Register">Регистрация</a>
</li> </li>
<li class="nav-item"> <li class="nav-item">
<a class="nav-link text-dark" asp-area="" asp-controller="Worker" asp-action="MainWorker">Работник</a> <a class="nav-link text-dark" asp-area="" asp-controller="Home" asp-action="MainWorker">Работник</a>
</li> </li>
</ul> </ul>
</div> </div>

View File

@ -20,19 +20,19 @@
<div class="navbar-collapse collapse d-sm-inline-flex justify-content-between"> <div class="navbar-collapse collapse d-sm-inline-flex justify-content-between">
<ul class="navbar-nav flex-grow-1"> <ul class="navbar-nav flex-grow-1">
<li class="nav-item"> <li class="nav-item">
<a class="nav-link text-dark" asp-area="" asp-controller="Worker" asp-action="Purchases">Покупки</a> <a class="nav-link text-dark" asp-area="" asp-controller="Home" asp-action="Purchases">Покупки</a>
</li> </li>
<li class="nav-item"> <li class="nav-item">
<a class="nav-link text-dark" asp-area="" asp-controller="Worker" asp-action="Builds">Сборки</a> <a class="nav-link text-dark" asp-area="" asp-controller="Home" asp-action="Builds">Сборки</a>
</li> </li>
<li class="nav-item"> <li class="nav-item">
<a class="nav-link text-dark" asp-area="" asp-controller="Worker" asp-action="Comments">Комментарии</a> <a class="nav-link text-dark" asp-area="" asp-controller="Home" asp-action="Comments">Комментарии</a>
</li> </li>
<li class="nav-item"> <li class="nav-item">
<a class="nav-link text-dark" asp-area="" asp-controller="Worker" asp-action="listComponents">Получение списка</a> <a class="nav-link text-dark" asp-area="" asp-controller="Home" asp-action="listComponents">Получение списка</a>
</li> </li>
<li class="nav-item"> <li class="nav-item">
<a class="nav-link text-dark" asp-area="" asp-controller="Worker" asp-action="WorkerReport">Отчёт</a> <a class="nav-link text-dark" asp-area="" asp-controller="Home" asp-action="WorkerReport">Отчёт</a>
</li> </li>
</ul> </ul>
</div> </div>