Components CRUD
This commit is contained in:
parent
fb2938e682
commit
6a5bb257d9
@ -13,7 +13,7 @@ namespace ComputerShopGuarantorApp
|
||||
|
||||
public static void Connect(IConfiguration Configuration)
|
||||
{
|
||||
_client.BaseAddress = new Uri(Configuration["IPAddress"]);
|
||||
_client.BaseAddress = new Uri(Configuration["IpAddress"]);
|
||||
_client.DefaultRequestHeaders.Accept.Clear();
|
||||
_client.DefaultRequestHeaders.Accept.Add(new MediaTypeWithQualityHeaderValue("application/json"));
|
||||
}
|
||||
|
@ -1,10 +1,14 @@
|
||||
using ComputerShopGuarantorApp.Models;
|
||||
using ComputerShopContracts.BindingModels;
|
||||
using ComputerShopContracts.ViewModels;
|
||||
using ComputerShopGuarantorApp.Models;
|
||||
using Microsoft.AspNetCore.Components;
|
||||
using Microsoft.AspNetCore.Mvc;
|
||||
using Microsoft.Extensions.Hosting;
|
||||
using System.Diagnostics;
|
||||
|
||||
namespace ComputerShopGuarantorApp.Controllers
|
||||
{
|
||||
public class HomeController : Controller
|
||||
public class HomeController : Controller
|
||||
{
|
||||
private readonly ILogger<HomeController> _logger;
|
||||
|
||||
@ -13,14 +17,239 @@ namespace ComputerShopGuarantorApp.Controllers
|
||||
_logger = logger;
|
||||
}
|
||||
|
||||
public IActionResult Index()
|
||||
{
|
||||
return View();
|
||||
public IActionResult Index()
|
||||
{
|
||||
if (ApiUser.User == null)
|
||||
{
|
||||
return Redirect("~/Home/Enter");
|
||||
}
|
||||
return View();
|
||||
}
|
||||
|
||||
/*------------------------------------------------------
|
||||
* Комплектующие
|
||||
*-----------------------------------------------------*/
|
||||
|
||||
public IActionResult Components()
|
||||
{
|
||||
if (ApiUser.User == null)
|
||||
return Redirect("~/Home/Enter");
|
||||
|
||||
return View(ApiUser.GetRequest<List<ComponentViewModel>>($"api/component/getcomponents?userId={ApiUser.User.Id}"));
|
||||
}
|
||||
|
||||
/*
|
||||
[HttpGet]
|
||||
public ComponentViewModel? GetComponent(int ComponentId)
|
||||
{
|
||||
if (ApiUser.User == null)
|
||||
throw new Exception("Необходима авторизация");
|
||||
|
||||
var Result = ApiUser.GetRequest<ComponentViewModel>($"api/component/getcomponent?id={ComponentId}");
|
||||
if (Result == null)
|
||||
{
|
||||
return default;
|
||||
}
|
||||
return Result;
|
||||
}
|
||||
*/
|
||||
|
||||
public IActionResult CreateComponent()
|
||||
{
|
||||
return View("Component");
|
||||
}
|
||||
|
||||
[HttpPost]
|
||||
public void CreateComponent(string ComponentName, double Cost)
|
||||
{
|
||||
if (ApiUser.User == null)
|
||||
throw new Exception("Вход только авторизованным");
|
||||
|
||||
ApiUser.PostRequest("api/component/createcomponent", new ComponentBindingModel
|
||||
{
|
||||
UserId = ApiUser.User.Id,
|
||||
ComponentName = ComponentName,
|
||||
Cost = Cost,
|
||||
});
|
||||
Response.Redirect("Components");
|
||||
}
|
||||
|
||||
public IActionResult UpdateComponent(int Id)
|
||||
{
|
||||
if (ApiUser.User == null)
|
||||
return Redirect("~/Home/Enter");
|
||||
|
||||
return View("Component", ApiUser.GetRequest<ComponentViewModel>($"api/component/getcomponent?id={Id}"));
|
||||
}
|
||||
|
||||
[HttpPost]
|
||||
public void UpdateComponent(int Id, string ComponentName, double Cost)
|
||||
{
|
||||
if (ApiUser.User == null)
|
||||
throw new Exception("Вход только авторизованным");
|
||||
|
||||
if (Id == 0)
|
||||
throw new Exception("Комплектующая не указана");
|
||||
|
||||
if (string.IsNullOrEmpty(ComponentName))
|
||||
throw new Exception("Наименование комплектующей не указано");
|
||||
|
||||
if (Cost <= 0.0)
|
||||
throw new Exception("Стоимость должна быть больше нуля");
|
||||
|
||||
ApiUser.PostRequest("api/component/updatecomponent", new ComponentBindingModel
|
||||
{
|
||||
Id = Id,
|
||||
UserId = ApiUser.User.Id,
|
||||
ComponentName = ComponentName,
|
||||
Cost = Cost,
|
||||
});
|
||||
Response.Redirect("../Components");
|
||||
}
|
||||
|
||||
public void DeleteComponent(int Id)
|
||||
{
|
||||
ApiUser.PostRequest($"api/component/deletecomponent", new ComponentBindingModel { Id = Id });
|
||||
Response.Redirect("../Components");
|
||||
}
|
||||
|
||||
/*------------------------------------------------------
|
||||
* Сборки
|
||||
*-----------------------------------------------------*/
|
||||
|
||||
public IActionResult Assemblies()
|
||||
{
|
||||
if (ApiUser.User == null)
|
||||
return Redirect("~/Home/Enter");
|
||||
|
||||
var Assemblies = ApiUser.GetRequest<List<AssemblyViewModel>>($"api/assembly/getassemblies?userId={ApiUser.User.Id}");
|
||||
return View(Assemblies);
|
||||
}
|
||||
|
||||
/*
|
||||
[HttpGet]
|
||||
public AssemblyViewModel? GetAssembly(int AssemblyId)
|
||||
{
|
||||
if (ApiUser.User == null)
|
||||
{
|
||||
throw new Exception("Необходима авторизация");
|
||||
}
|
||||
|
||||
var Result = ApiUser.GetRequest<AssemblyViewModel>($"api/assembly/getassembly?id={AssemblyId}");
|
||||
if (Result == null)
|
||||
{
|
||||
return default;
|
||||
}
|
||||
return Result;
|
||||
}
|
||||
*/
|
||||
|
||||
public IActionResult CreateAssembly()
|
||||
{
|
||||
if (ApiUser.User == null)
|
||||
throw new Exception("Вход только авторизованным");
|
||||
|
||||
ViewBag.Components = ApiUser.GetRequest<List<ComponentViewModel>>($"api/component/getcomponents?userId={ApiUser.User.Id}");
|
||||
return View("Assembly");
|
||||
}
|
||||
|
||||
[HttpPost]
|
||||
public void CreateAssembly(string AssemblyName, double Price, string Category, int[] ComponentIds)
|
||||
{
|
||||
if (ApiUser.User == null)
|
||||
throw new Exception("Вход только авторизованным");
|
||||
|
||||
var SelectedComponents = ComponentIds.ToDictionary(Id => Id, Id => new ComponentBindingModel { Id = Id });
|
||||
ApiUser.PostRequest("api/assembly/createAssembly", new AssemblyBindingModel
|
||||
{
|
||||
UserId = ApiUser.User.Id,
|
||||
AssemblyName = AssemblyName,
|
||||
Price = Price,
|
||||
Category = Category,
|
||||
AssemblyComponents = SelectedComponents,
|
||||
});
|
||||
Response.Redirect("Assemblies");
|
||||
}
|
||||
|
||||
public IActionResult UpdateAssembly(int Id)
|
||||
{
|
||||
if (ApiUser.User == null)
|
||||
return Redirect("~/Home/Enter");
|
||||
|
||||
ViewBag.Components = ApiUser.GetRequest<List<ComponentViewModel>>($"api/component/getcomponents?userId={ApiUser.User.Id}");
|
||||
return View("Assembly", ApiUser.GetRequest<AssemblyViewModel>($"api/assembly/getassembly?id={Id}"));
|
||||
}
|
||||
|
||||
[HttpPost]
|
||||
public void UpdateAssembly(int Id, string AssemblyName, double Price, string Category, int[] ComponentIds)
|
||||
{
|
||||
if (ApiUser.User == null)
|
||||
throw new Exception("Вход только авторизованным");
|
||||
|
||||
if (Id == 0)
|
||||
throw new Exception("Сборка не указана");
|
||||
|
||||
if (string.IsNullOrEmpty(AssemblyName))
|
||||
throw new Exception("Название сборки не указано");
|
||||
|
||||
if (string.IsNullOrEmpty(Category))
|
||||
throw new Exception("Категория не указана");
|
||||
|
||||
var SelectedComponents = ComponentIds.ToDictionary(Id => Id, Id => new ComponentBindingModel { Id = Id });
|
||||
ApiUser.PostRequest("api/assembly/updateassembly", new AssemblyBindingModel
|
||||
{
|
||||
Id = Id,
|
||||
UserId = ApiUser.User.Id,
|
||||
AssemblyName = AssemblyName,
|
||||
Price = Price,
|
||||
Category = Category,
|
||||
AssemblyComponents = SelectedComponents,
|
||||
});
|
||||
Response.Redirect("../Assemblies");
|
||||
}
|
||||
|
||||
public void DeleteAssembly(int Id)
|
||||
{
|
||||
ApiUser.PostRequest($"api/assembly/deleteassembly", new AssemblyBindingModel { Id = Id });
|
||||
Response.Redirect("../Assemblies");
|
||||
}
|
||||
|
||||
|
||||
// ОСТАЛЬНОЕ ОСТАЛЬНОЕ ОСТАЛЬНОЕ ОСТАЛЬНОЕ ОСТАЛЬНОЕ ОСТАЛЬНОЕ ОСТАЛЬНОЕ
|
||||
|
||||
[HttpGet]
|
||||
public IActionResult Privacy()
|
||||
{
|
||||
return View();
|
||||
if (ApiUser.User == null)
|
||||
{
|
||||
return Redirect("~/Home/Enter");
|
||||
}
|
||||
return View(ApiUser.User);
|
||||
}
|
||||
|
||||
[HttpPost]
|
||||
public void Privacy(string Login, string Password, string Email)
|
||||
{
|
||||
if (ApiUser.User == null)
|
||||
{
|
||||
throw new Exception("Вход только авторизованным");
|
||||
}
|
||||
if (string.IsNullOrEmpty(Login) || string.IsNullOrEmpty(Password) || string.IsNullOrEmpty(Email))
|
||||
{
|
||||
throw new Exception("Введите логин, пароль и почту");
|
||||
}
|
||||
ApiUser.PostRequest("api/user/updatedata", new UserBindingModel
|
||||
{
|
||||
Id = ApiUser.User.Id,
|
||||
Login = Login,
|
||||
Password = Password,
|
||||
Email = Email
|
||||
});
|
||||
|
||||
ApiUser.User.Login = Login;
|
||||
ApiUser.User.Password = Password;
|
||||
ApiUser.User.Email = Email;
|
||||
Response.Redirect("Index");
|
||||
}
|
||||
|
||||
[ResponseCache(Duration = 0, Location = ResponseCacheLocation.None, NoStore = true)]
|
||||
@ -28,5 +257,52 @@ namespace ComputerShopGuarantorApp.Controllers
|
||||
{
|
||||
return View(new ErrorViewModel { RequestId = Activity.Current?.Id ?? HttpContext.TraceIdentifier });
|
||||
}
|
||||
|
||||
public IActionResult Enter()
|
||||
{
|
||||
return View();
|
||||
}
|
||||
|
||||
[HttpPost]
|
||||
public void Enter(string Login, string Password)
|
||||
{
|
||||
if (string.IsNullOrEmpty(Login) || string.IsNullOrEmpty(Password))
|
||||
{
|
||||
throw new Exception("Введите логин и пароль");
|
||||
}
|
||||
ApiUser.User = ApiUser.GetRequest<UserViewModel>($"api/user/loginguarantor?login={Login}&password={Password}");
|
||||
if (ApiUser.User == null)
|
||||
{
|
||||
throw new Exception("Неверный логин или пароль");
|
||||
}
|
||||
Response.Redirect("Index");
|
||||
}
|
||||
|
||||
public IActionResult Register()
|
||||
{
|
||||
return View();
|
||||
}
|
||||
|
||||
[HttpPost]
|
||||
public void Register(string Login, string Password, string Email)
|
||||
{
|
||||
if (string.IsNullOrEmpty(Login) || string.IsNullOrEmpty(Password) || string.IsNullOrEmpty(Email))
|
||||
{
|
||||
throw new Exception("Введите логин, пароль и почту");
|
||||
}
|
||||
ApiUser.PostRequest("api/user/registerguarantor", new UserBindingModel
|
||||
{
|
||||
Login = Login,
|
||||
Password = Password,
|
||||
Email = Email
|
||||
});
|
||||
ApiUser.User = ApiUser.GetRequest<UserViewModel>($"api/user/loginguarantor?login={Login}&password={Password}");
|
||||
if (ApiUser.User == null)
|
||||
{
|
||||
Response.Redirect("Enter");
|
||||
}
|
||||
Response.Redirect("Index");
|
||||
return;
|
||||
}
|
||||
}
|
||||
}
|
||||
|
@ -18,9 +18,7 @@ if (!App.Environment.IsDevelopment())
|
||||
|
||||
App.UseHttpsRedirection();
|
||||
App.UseStaticFiles();
|
||||
|
||||
App.UseRouting();
|
||||
|
||||
App.UseAuthorization();
|
||||
|
||||
App.MapControllerRoute(
|
||||
|
61
ComputerShopGuarantorApp/Views/Home/Assemblies.cshtml
Normal file
61
ComputerShopGuarantorApp/Views/Home/Assemblies.cshtml
Normal file
@ -0,0 +1,61 @@
|
||||
@using ComputerShopContracts.ViewModels
|
||||
|
||||
@model List<AssemblyViewModel>
|
||||
@{
|
||||
ViewData["Title"] = "Сборки";
|
||||
}
|
||||
|
||||
<div class="container-md py-4 mb-4">
|
||||
<div class="text-center">
|
||||
<h2>Список сборок</h2>
|
||||
<p class="lead text-muted">Просматривайте список сборок и создавайте новые, а также выбирайте сборку для изменения или удаления</p>
|
||||
</div>
|
||||
|
||||
@{
|
||||
if (Model == null)
|
||||
{
|
||||
<h3 class="display-4">Авторизируйтесь</h3>
|
||||
return;
|
||||
}
|
||||
<p>
|
||||
<a class="btn btn-primary" asp-action="CreateAssembly">Создать сборку</a>
|
||||
</p>
|
||||
<table class="table table-striped">
|
||||
<thead>
|
||||
<tr>
|
||||
<th>Номер</th>
|
||||
<th>Название</th>
|
||||
<th>Цена</th>
|
||||
<th>Категория</th>
|
||||
<th></th>
|
||||
<th></th>
|
||||
</tr>
|
||||
</thead>
|
||||
<tbody>
|
||||
@foreach (var Item in Model)
|
||||
{
|
||||
<tr>
|
||||
<td>
|
||||
@Html.DisplayFor(ModelItem => Item.Id)
|
||||
</td>
|
||||
<td>
|
||||
@Html.DisplayFor(ModelItem => Item.AssemblyName)
|
||||
</td>
|
||||
<td>
|
||||
@Html.DisplayFor(ModelItem => Item.Price)
|
||||
</td>
|
||||
<td>
|
||||
@Html.DisplayFor(ModelItem => Item.Category)
|
||||
</td>
|
||||
<td>
|
||||
<a asp-action="UpdateAssembly" asp-route-Id="@(Item.Id)" role="button"><i class="bi bi-pen-fill"></i></a>
|
||||
</td>
|
||||
<td>
|
||||
<a asp-action="DeleteAssembly" asp-route-Id="@(Item.Id)" role="button"><i class="bi bi-trash-fill"></i></a>
|
||||
</td>
|
||||
</tr>
|
||||
}
|
||||
</tbody>
|
||||
</table>
|
||||
}
|
||||
</div>
|
57
ComputerShopGuarantorApp/Views/Home/Assembly.cshtml
Normal file
57
ComputerShopGuarantorApp/Views/Home/Assembly.cshtml
Normal file
@ -0,0 +1,57 @@
|
||||
@using ComputerShopDataModels.Enums;
|
||||
@using ComputerShopContracts.ViewModels;
|
||||
|
||||
@model AssemblyViewModel
|
||||
|
||||
@{
|
||||
ViewData["Title"] = "Сборка";
|
||||
}
|
||||
|
||||
<div class="container-md py-4 mb-4">
|
||||
<div class="text-center">
|
||||
@if (Model == null)
|
||||
{
|
||||
<h2>Создание сборки</h2>
|
||||
}
|
||||
else
|
||||
{
|
||||
<h2>Редактирование сборки</h2>
|
||||
}
|
||||
</div>
|
||||
|
||||
<form method="post">
|
||||
<div class="form-group">
|
||||
<label class="mb-3">Название:</label>
|
||||
<input type="text" name="assemblyName" class="mb-3 form-control" value="@(Model == null ? "" : Model.AssemblyName)">
|
||||
</div>
|
||||
|
||||
<div class="form-group">
|
||||
<label class="mb-3">Цена:</label>
|
||||
<input type="number" name="cost" class="mb-3 form-control" value="@(Model == null ? 0 : Model.Price)" readonly>
|
||||
</div>
|
||||
|
||||
<div class="form-group">
|
||||
<label class="mb-3">Категория:</label>
|
||||
<input type="text" name="category" class="mb-3 form-control" value="@(Model == null ? "" : Model.Category)">
|
||||
</div>
|
||||
|
||||
<div class="form-group">
|
||||
<label class="mb-3">Комплектующие:</label>
|
||||
<select multiple size="6" name="componentIds" class="form-control">
|
||||
@{
|
||||
foreach (var Component in ViewBag.Components)
|
||||
{
|
||||
<option value="@Component.Id">@Component.ComponentName</option>
|
||||
}
|
||||
}
|
||||
</select>
|
||||
</div>
|
||||
|
||||
<div class="row">
|
||||
<div class="col-8"></div>
|
||||
<div class="col-4">
|
||||
<input type="submit" value="Сохранить" class="btn btn-primary" />
|
||||
</div>
|
||||
</div>
|
||||
</form>
|
||||
</div>
|
40
ComputerShopGuarantorApp/Views/Home/Component.cshtml
Normal file
40
ComputerShopGuarantorApp/Views/Home/Component.cshtml
Normal file
@ -0,0 +1,40 @@
|
||||
@using ComputerShopDataModels.Enums;
|
||||
@using ComputerShopContracts.ViewModels;
|
||||
|
||||
@model ComponentViewModel
|
||||
|
||||
@{
|
||||
ViewData["Title"] = "Комплектующая";
|
||||
}
|
||||
|
||||
<div class="container-md py-4 mb-4">
|
||||
<div class="text-center">
|
||||
@if (Model == null)
|
||||
{
|
||||
<h2>Создание комплектующей</h2>
|
||||
}
|
||||
else
|
||||
{
|
||||
<h2>Редактирование комплектующей</h2>
|
||||
}
|
||||
</div>
|
||||
|
||||
<form method="post">
|
||||
<div class="form-group">
|
||||
<label class="mb-3">Наименование:</label>
|
||||
<input type="text" name="componentName" class="mb-3 form-control" value="@(Model == null ? "" : Model.ComponentName)">
|
||||
</div>
|
||||
|
||||
<div class="form-group">
|
||||
<label class="mb-3">Стоимость:</label>
|
||||
<input type="number" name="cost" class="mb-3 form-control" step="1" value="@(Model == null ? 0 : Model.Cost)">
|
||||
</div>
|
||||
|
||||
<div class="row">
|
||||
<div class="col-8"></div>
|
||||
<div class="col-4">
|
||||
<input type="submit" value="Сохранить" class="btn btn-primary" />
|
||||
</div>
|
||||
</div>
|
||||
</form>
|
||||
</div>
|
57
ComputerShopGuarantorApp/Views/Home/Components.cshtml
Normal file
57
ComputerShopGuarantorApp/Views/Home/Components.cshtml
Normal file
@ -0,0 +1,57 @@
|
||||
@using ComputerShopContracts.ViewModels
|
||||
|
||||
@model List<ComponentViewModel>
|
||||
@{
|
||||
ViewData["Title"] = "Комплектующие";
|
||||
}
|
||||
|
||||
<div class="container-md py-4 mb-4">
|
||||
<div class="text-center">
|
||||
<h2>Список комплектующих</h2>
|
||||
<p class="lead text-muted">Просматривайте список комплектующих и добавляйте новые, а также выбирайте комплектующую для изменения или удаления</p>
|
||||
</div>
|
||||
|
||||
@{
|
||||
if (Model == null)
|
||||
{
|
||||
<h3 class="display-4">Авторизируйтесь</h3>
|
||||
return;
|
||||
}
|
||||
<p>
|
||||
<a class="btn btn-primary" asp-action="CreateComponent">Создать комплектующую</a>
|
||||
</p>
|
||||
<table class="table table-striped">
|
||||
<thead>
|
||||
<tr>
|
||||
<th>Номер</th>
|
||||
<th>Наименование</th>
|
||||
<th>Стоимость</th>
|
||||
<th></th>
|
||||
<th></th>
|
||||
</tr>
|
||||
</thead>
|
||||
<tbody>
|
||||
@foreach (var Item in Model)
|
||||
{
|
||||
<tr>
|
||||
<td>
|
||||
@Html.DisplayFor(ModelItem => Item.Id)
|
||||
</td>
|
||||
<td>
|
||||
@Html.DisplayFor(ModelItem => Item.ComponentName)
|
||||
</td>
|
||||
<td>
|
||||
@Html.DisplayFor(ModelItem => Item.Cost)
|
||||
</td>
|
||||
<td>
|
||||
<a asp-action="UpdateComponent" asp-route-Id="@(Item.Id)" role="button"><i class="bi bi-pen-fill"></i></a>
|
||||
</td>
|
||||
<td>
|
||||
<a asp-action="DeleteComponent" asp-route-Id="@(Item.Id)" role="button"><i class="bi bi-trash-fill"></i></a>
|
||||
</td>
|
||||
</tr>
|
||||
}
|
||||
</tbody>
|
||||
</table>
|
||||
}
|
||||
</div>
|
54
ComputerShopGuarantorApp/Views/Home/Enter.cshtml
Normal file
54
ComputerShopGuarantorApp/Views/Home/Enter.cshtml
Normal file
@ -0,0 +1,54 @@
|
||||
@{
|
||||
ViewData["Title"] = "Вход";
|
||||
}
|
||||
|
||||
<div class="container-sm py-4">
|
||||
<div class="text-center">
|
||||
<h2>Вход в аккаунт</h2>
|
||||
<p class="lead text-muted">Войдите в ваш аккаунт чтобы иметь доступ к комплектующим, сборкам и товарам</p>
|
||||
</div>
|
||||
|
||||
<div class="row justify-content-center mt-5">
|
||||
<div class="col-lg-4">
|
||||
<div class="card">
|
||||
<div class="card-body">
|
||||
<div class="d-flex flex-row justify-content-center">
|
||||
<i class="bi bi-person-circle login-icon text-primary" style="font-size: 30px"></i>
|
||||
<p class="lead my-auto ms-3 text-primary">Вход</p>
|
||||
</div>
|
||||
|
||||
<form method="post" class="my-3">
|
||||
<label for="email" class="form-label">Логин</label>
|
||||
<div class="input-group mb-3">
|
||||
<span class="input-group-text"><i class="bi bi-envelope-fill"></i></span>
|
||||
<input type="text" class="form-control" name="login">
|
||||
</div>
|
||||
|
||||
<label for="password" class="form-label">Пароль</label>
|
||||
<div class="input-group mb-3">
|
||||
<span class="input-group-text"><i class="bi bi-lock-fill"></i></span>
|
||||
<input type="password" class="form-control" name="password">
|
||||
<div class="input-group-text" id="hidePassword">
|
||||
<a href=""><i class="bi bi-eye-fill"></i></a>
|
||||
</div>
|
||||
</div>
|
||||
|
||||
<div class="input-group mt-4 d-flex justify-content-between">
|
||||
<div class="form-check">
|
||||
<input type="checkbox" class="form-check-input" id="formCheck">
|
||||
<label for="formCheck" class="form-check-label text-secondary"><small>Запомнить на этом компьютере</small></label>
|
||||
</div>
|
||||
<div class="forgot">
|
||||
<p class="btn btn-sm text-primary p-0 border-0">Забыли пароль?</p>
|
||||
</div>
|
||||
</div>
|
||||
|
||||
<div class="text-center mt-5">
|
||||
<input type="submit" value="Вход" class="btn btn-primary" />
|
||||
</div>
|
||||
</form>
|
||||
</div>
|
||||
</div>
|
||||
</div>
|
||||
</div>
|
||||
</div>
|
60
ComputerShopGuarantorApp/Views/Home/Register.cshtml
Normal file
60
ComputerShopGuarantorApp/Views/Home/Register.cshtml
Normal file
@ -0,0 +1,60 @@
|
||||
@{
|
||||
ViewData["Title"] = "Регистрация";
|
||||
}
|
||||
|
||||
<div class="container-sm py-4">
|
||||
<div class="text-center">
|
||||
<h2>Регистрация аккаунта</h2>
|
||||
<p class="lead text-muted">Зарегистрируйте аккаунт поручителя, чтобы управлять комплектующими, сборками и товарами</p>
|
||||
</div>
|
||||
|
||||
<div class="row justify-content-center mt-5">
|
||||
<div class="col-lg-4">
|
||||
<div class="card">
|
||||
<div class="card-body">
|
||||
<div class="d-flex flex-row justify-content-center">
|
||||
<i class="bi bi-people-fill login-icon text-primary" style="font-size: 30px"></i>
|
||||
<p class="lead my-auto ms-3 text-primary">Регистрация</p>
|
||||
</div>
|
||||
|
||||
<form method="post" class="my-3">
|
||||
<label for="login" class="form-label">Логин</label>
|
||||
<div class="input-group mb-3">
|
||||
<span class="input-group-text"><i class="bi bi-chat-square-quote-fill"></i></span>
|
||||
<input type="text" class="form-control" name="login">
|
||||
</div>
|
||||
|
||||
<label for="email" class="form-label">Почта</label>
|
||||
<div class="input-group mb-3">
|
||||
<span class="input-group-text"><i class="bi bi-envelope-fill"></i></span>
|
||||
<input type="email" class="form-control" name="email" placeholder="myemail@mail.com">
|
||||
</div>
|
||||
|
||||
<label for="password" class="form-label">Пароль</label>
|
||||
<div class="input-group mb-3">
|
||||
<span class="input-group-text"><i class="bi bi-lock-fill"></i></span>
|
||||
<input type="password" class="form-control" name="password">
|
||||
<div class="input-group-text" id="hidePassword">
|
||||
<a href=""><i class="bi bi-eye-fill"></i></a>
|
||||
</div>
|
||||
</div>
|
||||
|
||||
<div class="input-group mt-4 d-flex justify-content-between">
|
||||
<div class="form-check">
|
||||
<input type="checkbox" class="form-check-input" id="formCheck">
|
||||
<label for="formCheck" class="form-check-label text-secondary"><small>Запомнить на этом компьютере</small></label>
|
||||
</div>
|
||||
<div class="forgot">
|
||||
<p class="btn btn-sm text-primary p-0 border-0">Забыли пароль?</p>
|
||||
</div>
|
||||
</div>
|
||||
|
||||
<div class="text-center mt-5">
|
||||
<input type="submit" value="Зарегистрироваться" class="btn btn-primary" />
|
||||
</div>
|
||||
</form>
|
||||
</div>
|
||||
</div>
|
||||
</div>
|
||||
</div>
|
||||
</div>
|
@ -5,14 +5,18 @@
|
||||
<meta name="viewport" content="width=device-width, initial-scale=1.0" />
|
||||
<title>@ViewData["Title"] - Поручитель</title>
|
||||
<link rel="stylesheet" href="~/lib/bootstrap/dist/css/bootstrap.min.css" />
|
||||
<link rel="stylesheet" href="https://cdn.jsdelivr.net/npm/bootstrap-icons@1.9.1/font/bootstrap-icons.css">
|
||||
<link rel="stylesheet" href="~/css/site.css" asp-append-version="true" />
|
||||
<link rel="stylesheet" href="~/ComputerShopGuarantorApp.styles.css" asp-append-version="true" />
|
||||
</head>
|
||||
<body class="d-flex flex-column min-vh-100" padding="56px">
|
||||
<body>
|
||||
<header>
|
||||
<nav class="navbar fixed-top navbar-expand-lg navbar-dark bg-dark">
|
||||
<nav class="navbar navbar-expand-lg navbar-dark bg-dark">
|
||||
<div class="container-md">
|
||||
<a class="navbar-brand" asp-area="" asp-controller="Home" asp-action="Index"><span class="fw-bold text-uppercase ms-2">Приложение поручителя</span></a>
|
||||
<a class="navbar-brand" asp-area="" asp-controller="Home" asp-action="Index">
|
||||
<i class="bi bi-pc-display-horizontal pt-5" style="font-size:30px; line-height:0px"></i>
|
||||
<span class="fw-bold text-uppercase ms-2">Ты ж программист</span>
|
||||
</a>
|
||||
<button class="navbar-toggler" type="button" data-bs-toggle="collapse" data-bs-target=".navbar-collapse" aria-controls="navbarSupportedContent"
|
||||
aria-expanded="false" aria-label="Toggle navigation">
|
||||
<span class="navbar-toggler-icon"></span>
|
||||
@ -20,17 +24,39 @@
|
||||
<div class="collapse navbar-collapse justify-content-end align-center" id="main-nav">
|
||||
<ul class="navbar-nav">
|
||||
<li class="nav-item me-3">
|
||||
<a class="nav-link" asp-area="" asp-controller="Home" asp-action="Index">Главная</a>
|
||||
<a class="nav-link" asp-area="" asp-controller="Home" asp-action="Components">Комплектующие</a>
|
||||
</li>
|
||||
<li class="nav-item me-3">
|
||||
<a class="nav-link" asp-area="" asp-controller="Home" asp-action="Privacy">Privacy</a>
|
||||
<a class="nav-link" asp-area="" asp-controller="Home" asp-action="Assemblies">Сборки</a>
|
||||
</li>
|
||||
<li class="nav-item d-lg-none">
|
||||
<a class="nav-link text-light" asp-area="" asp-controller="Home" asp-action="Privacy">Вход в аккаунт</a>
|
||||
<li class="nav-item me-3">
|
||||
<a class="nav-link" asp-area="" asp-controller="Home" asp-action="Products">Товары</a>
|
||||
</li>
|
||||
<li class="nav-item me-3">
|
||||
<a class="nav-link" asp-area="" asp-controller="Home" asp-action="Index">Отчет</a>
|
||||
</li>
|
||||
<li class="nav-item d-none d-lg-inline">
|
||||
<a class="btn btn-light" asp-area="" asp-controller="Home" asp-action="Privacy">Вход в аккаунт</a>
|
||||
<li class="nav-item me-3">
|
||||
<a class="nav-link" asp-area="" asp-controller="Home" asp-action="Index">Выгрузка списка</a>
|
||||
</li>
|
||||
|
||||
@if (ApiUser.User == null)
|
||||
{
|
||||
<li class="nav-item me-3">
|
||||
<a class="nav-link" asp-area="" asp-controller="Home" asp-action="Register">Регистрация</a>
|
||||
</li>
|
||||
<li class="nav-item d-lg-none">
|
||||
<a class="nav-link text-light" asp-area="" asp-controller="Home" asp-action="Enter">Вход в аккаунт</a>
|
||||
</li>
|
||||
<li class="nav-item d-none d-lg-inline">
|
||||
<a class="btn btn-light" asp-area="" asp-controller="Home" asp-action="Enter">Вход в аккаунт</a>
|
||||
</li>
|
||||
}
|
||||
else
|
||||
{
|
||||
<li class="nav-item me-3">
|
||||
<a class="nav-link" asp-area="" asp-controller="Home" asp-action="Privacy">Профиль</a>
|
||||
</li>
|
||||
}
|
||||
</ul>
|
||||
</div>
|
||||
</div>
|
||||
@ -42,9 +68,9 @@
|
||||
</main>
|
||||
</div>
|
||||
|
||||
<footer class="border-top footer text-muted">
|
||||
<footer class="bg-dark text-light mt-auto footer">
|
||||
<div class="container">
|
||||
© 2024 - ComputerShopGuarantorApp - <a asp-area="" asp-controller="Home" asp-action="Privacy">Privacy</a>
|
||||
© 2024 - "Ты ж программист" @* - <a asp-area="" asp-controller="Home" asp-action="Privacy" class="text-decoration-underline text-secondary">Privacy</a> *@
|
||||
</div>
|
||||
</footer>
|
||||
<script src="~/lib/jquery/dist/jquery.min.js"></script>
|
||||
|
@ -6,5 +6,5 @@
|
||||
}
|
||||
},
|
||||
"AllowedHosts": "*",
|
||||
"IPAddress": "http://localhost:5024"
|
||||
"IpAddress": "http://localhost:5055"
|
||||
}
|
||||
|
@ -97,7 +97,7 @@ namespace ComputerShopRestApi.Controllers
|
||||
}
|
||||
}
|
||||
|
||||
[HttpDelete]
|
||||
[HttpPost]
|
||||
public void DeleteAssembly(AssemblyBindingModel Model)
|
||||
{
|
||||
try
|
||||
|
@ -81,7 +81,7 @@ namespace ComputerShopRestApi.Controllers
|
||||
}
|
||||
}
|
||||
|
||||
[HttpDelete]
|
||||
[HttpPost]
|
||||
public void DeleteComponent(ComponentBindingModel Model)
|
||||
{
|
||||
try
|
||||
|
@ -82,7 +82,7 @@ namespace ComputerShopRestApi.Controllers
|
||||
}
|
||||
}
|
||||
|
||||
[HttpDelete]
|
||||
[HttpPost]
|
||||
public void DeleteProduct(ProductBindingModel Model)
|
||||
{
|
||||
try
|
||||
|
Loading…
Reference in New Issue
Block a user