From fb2938e68214da8f86b3762fb8a8c4c925f0a355 Mon Sep 17 00:00:00 2001 From: Oleg Shabunov Date: Tue, 28 May 2024 18:48:09 +0400 Subject: [PATCH 1/4] Fix JSON interface deserialization error --- .../BusinessLogics/AssemblyLogic.cs | 3 -- .../BusinessLogics/ProductLogic.cs | 3 -- .../BindingModels/AssemblyBindingModel.cs | 4 +-- .../BindingModels/ProductBindingModel.cs | 2 +- .../ViewModels/AssemblyViewModel.cs | 6 ++-- .../ViewModels/ProductViewModel.cs | 2 +- .../Models/IAssemblyModel.cs | 5 ---- .../Models/IProductModel.cs | 5 ---- .../Models/Assembly.cs | 29 +++++-------------- .../Models/Product.cs | 12 ++++---- .../Controllers/ProductController.cs | 1 + 11 files changed, 21 insertions(+), 51 deletions(-) diff --git a/ComputerShopBusinessLogic/BusinessLogics/AssemblyLogic.cs b/ComputerShopBusinessLogic/BusinessLogics/AssemblyLogic.cs index 5d36982..dca0b6b 100644 --- a/ComputerShopBusinessLogic/BusinessLogics/AssemblyLogic.cs +++ b/ComputerShopBusinessLogic/BusinessLogics/AssemblyLogic.cs @@ -102,9 +102,6 @@ namespace ComputerShopBusinessLogic.BusinessLogics if (string.IsNullOrEmpty(Model.Category)) throw new ArgumentException($"У сборки отсутствует категория"); - if (Model.Price < 0) - throw new ArgumentException("Цена сборки должна быть больше 0", nameof(Model.Price)); - var Element = _assemblyStorage.GetElement(new AssemblySearchModel { AssemblyName = Model.AssemblyName diff --git a/ComputerShopBusinessLogic/BusinessLogics/ProductLogic.cs b/ComputerShopBusinessLogic/BusinessLogics/ProductLogic.cs index 19db180..4083bfb 100644 --- a/ComputerShopBusinessLogic/BusinessLogics/ProductLogic.cs +++ b/ComputerShopBusinessLogic/BusinessLogics/ProductLogic.cs @@ -110,9 +110,6 @@ namespace ComputerShopBusinessLogic.BusinessLogics if (string.IsNullOrEmpty(Model.ProductName)) throw new ArgumentException($"У товара отсутствует название"); - if (Model.Price < 0) - throw new ArgumentException("Цена товара должна быть больше 0", nameof(Model.Price)); - if (Model.Warranty <= 0) throw new ArgumentException("Гарантия на товар должна быть больше 0", nameof(Model.Warranty)); diff --git a/ComputerShopContracts/BindingModels/AssemblyBindingModel.cs b/ComputerShopContracts/BindingModels/AssemblyBindingModel.cs index b007899..334c8a8 100644 --- a/ComputerShopContracts/BindingModels/AssemblyBindingModel.cs +++ b/ComputerShopContracts/BindingModels/AssemblyBindingModel.cs @@ -14,8 +14,6 @@ namespace ComputerShopContracts.BindingModels public string Category { get; set; } = string.Empty; - public Dictionary AssemblyComponents { get; set; } = new(); - - public Dictionary Test { get; set; } = new(); + public Dictionary AssemblyComponents { get; set; } = new(); } } diff --git a/ComputerShopContracts/BindingModels/ProductBindingModel.cs b/ComputerShopContracts/BindingModels/ProductBindingModel.cs index 1fb28ec..73c3eb8 100644 --- a/ComputerShopContracts/BindingModels/ProductBindingModel.cs +++ b/ComputerShopContracts/BindingModels/ProductBindingModel.cs @@ -16,6 +16,6 @@ namespace ComputerShopContracts.BindingModels public int Warranty { get; set; } - public Dictionary ProductComponents { get; set; } = new(); + public Dictionary ProductComponents { get; set; } = new(); } } diff --git a/ComputerShopContracts/ViewModels/AssemblyViewModel.cs b/ComputerShopContracts/ViewModels/AssemblyViewModel.cs index e536e9a..178a06e 100644 --- a/ComputerShopContracts/ViewModels/AssemblyViewModel.cs +++ b/ComputerShopContracts/ViewModels/AssemblyViewModel.cs @@ -3,7 +3,7 @@ using System.ComponentModel; namespace ComputerShopContracts.ViewModels { - public class AssemblyViewModel : IAssemblyModel + public class AssemblyViewModel : IAssemblyModel { public int Id { get; set; } @@ -18,6 +18,6 @@ namespace ComputerShopContracts.ViewModels [DisplayName("Категория")] public string Category { get; set; } = string.Empty; - public Dictionary AssemblyComponents { get; set; } = new(); - } + public Dictionary AssemblyComponents { get; set; } = new(); + } } diff --git a/ComputerShopContracts/ViewModels/ProductViewModel.cs b/ComputerShopContracts/ViewModels/ProductViewModel.cs index a5d4498..1c60c49 100644 --- a/ComputerShopContracts/ViewModels/ProductViewModel.cs +++ b/ComputerShopContracts/ViewModels/ProductViewModel.cs @@ -23,6 +23,6 @@ namespace ComputerShopContracts.ViewModels [DisplayName("Гарантия (мес.)")] public int Warranty { get; set; } - public Dictionary ProductComponents { get; set; } = new(); + public Dictionary ProductComponents { get; set; } = new(); } } diff --git a/ComputerShopDataModels/Models/IAssemblyModel.cs b/ComputerShopDataModels/Models/IAssemblyModel.cs index 8ad19f7..09c7ce1 100644 --- a/ComputerShopDataModels/Models/IAssemblyModel.cs +++ b/ComputerShopDataModels/Models/IAssemblyModel.cs @@ -24,10 +24,5 @@ /// Категория /// string Category { get; } - - /// - /// Список комплектующих - /// - Dictionary AssemblyComponents { get; } } } diff --git a/ComputerShopDataModels/Models/IProductModel.cs b/ComputerShopDataModels/Models/IProductModel.cs index 7e82289..1ec0616 100644 --- a/ComputerShopDataModels/Models/IProductModel.cs +++ b/ComputerShopDataModels/Models/IProductModel.cs @@ -25,11 +25,6 @@ /// int Warranty { get; } - /// - /// Список комплектующих - /// - Dictionary ProductComponents { get; } - /// /// Привязка товара к партии товаров /// diff --git a/ComputerShopDatabaseImplement/Models/Assembly.cs b/ComputerShopDatabaseImplement/Models/Assembly.cs index 4cbe166..d580ef1 100644 --- a/ComputerShopDatabaseImplement/Models/Assembly.cs +++ b/ComputerShopDatabaseImplement/Models/Assembly.cs @@ -28,10 +28,10 @@ namespace ComputerShopDatabaseImplement.Models [ForeignKey("AssemblyId")] public virtual List Components { get; set; } = new(); - private Dictionary? _assemblyComponents; + private Dictionary? _assemblyComponents; [NotMapped] - public Dictionary AssemblyComponents + public Dictionary AssemblyComponents { get { @@ -39,7 +39,7 @@ namespace ComputerShopDatabaseImplement.Models { _assemblyComponents = Components.ToDictionary( AsmComp => AsmComp.ComponentId, - AsmComp => AsmComp.Component as IComponentModel + AsmComp => AsmComp.Component ); } @@ -88,13 +88,14 @@ namespace ComputerShopDatabaseImplement.Models AssemblyName = AssemblyName, Price = Price, Category = Category, - AssemblyComponents = AssemblyComponents, + AssemblyComponents = AssemblyComponents.ToDictionary(x => x.Key, x => x.Value.ViewModel), }; public void UpdateComponents(ComputerShopDatabase Context, AssemblyBindingModel Model) { - // Сначала подсчитывается новая цена, т.к. Model.AssemblyComponents далее может измениться - double NewPrice = Context.Components + // Сначала подсчитывается новая цена, т.к. Model.AssemblyComponents далее может измениться + double NewPrice = Context.Components + .ToList() .Where(x => Model.AssemblyComponents.ContainsKey(x.Id)) .Sum(x => x.Cost); @@ -132,21 +133,5 @@ namespace ComputerShopDatabaseImplement.Models _assemblyComponents = null; } - - private void CalculatePrice( - ComputerShopDatabase Context, - Dictionary ModelComponents, - out List OutComponents, - out double OutPrice) - { - OutComponents = ModelComponents - .Select(x => new AssemblyComponent - { - Component = Context.Components.First(y => y.Id == x.Key) - }) - .ToList(); - - OutPrice = Components.Sum(x => x.Component.Cost); - } } } diff --git a/ComputerShopDatabaseImplement/Models/Product.cs b/ComputerShopDatabaseImplement/Models/Product.cs index 24df409..4871f04 100644 --- a/ComputerShopDatabaseImplement/Models/Product.cs +++ b/ComputerShopDatabaseImplement/Models/Product.cs @@ -29,10 +29,10 @@ namespace ComputerShopDatabaseImplement.Models [ForeignKey("ProductId")] public virtual List Components { get; set; } = new(); - private Dictionary? _productComponents; + private Dictionary? _productComponents; [NotMapped] - public Dictionary ProductComponents + public Dictionary ProductComponents { get { @@ -40,7 +40,7 @@ namespace ComputerShopDatabaseImplement.Models { _productComponents = Components.ToDictionary( ProdComp => ProdComp.ComponentId, - ProdComp => ProdComp.Component as IComponentModel + ProdComp => ProdComp.Component ); } @@ -64,7 +64,7 @@ namespace ComputerShopDatabaseImplement.Models UserId = Model.UserId, ShipmentId = Model.ShipmentId, ProductName = Model.ProductName, - Price = Model.Price, + Price = Price, Warranty = Model.Warranty, Components = Components, }; @@ -87,15 +87,17 @@ namespace ComputerShopDatabaseImplement.Models UserId = UserId, ShipmentId = ShipmentId, ProviderName = Shipment?.ProviderName, + ProductName = ProductName, Price = Price, Warranty = Warranty, - ProductComponents = ProductComponents, + ProductComponents = ProductComponents.ToDictionary(x => x.Key, x => x.Value.ViewModel), }; public void UpdateComponents(ComputerShopDatabase Context, ProductBindingModel Model) { // Сначала подсчитывается новая цена, т.к. Model.ProductComponents далее может измениться double NewPrice = Context.Components + .ToList() .Where(x => Model.ProductComponents.ContainsKey(x.Id)) .Sum(x => x.Cost); diff --git a/ComputerShopRestApi/Controllers/ProductController.cs b/ComputerShopRestApi/Controllers/ProductController.cs index 311505d..c41d6a6 100644 --- a/ComputerShopRestApi/Controllers/ProductController.cs +++ b/ComputerShopRestApi/Controllers/ProductController.cs @@ -58,6 +58,7 @@ namespace ComputerShopRestApi.Controllers { try { + if (Model.ShipmentId == 0) Model.ShipmentId = null; _productLogic.Create(Model); } catch (Exception ex) From 6a5bb257d9c785175c1982343d985c94c6c67f8f Mon Sep 17 00:00:00 2001 From: Oleg Shabunov Date: Wed, 29 May 2024 01:02:20 +0400 Subject: [PATCH 2/4] Components CRUD --- ComputerShopGuarantorApp/ApiUser.cs | 2 +- .../Controllers/HomeController.cs | 288 +++++++++++++++++- ComputerShopGuarantorApp/Program.cs | 2 - .../Views/Home/Assemblies.cshtml | 61 ++++ .../Views/Home/Assembly.cshtml | 57 ++++ .../Views/Home/Component.cshtml | 40 +++ .../Views/Home/Components.cshtml | 57 ++++ .../Views/Home/Enter.cshtml | 54 ++++ .../Views/Home/Register.cshtml | 60 ++++ .../Views/Shared/_Layout.cshtml | 48 ++- ComputerShopGuarantorApp/appsettings.json | 2 +- .../Controllers/AssemblyController.cs | 2 +- .../Controllers/ComponentController.cs | 2 +- .../Controllers/ProductController.cs | 2 +- 14 files changed, 653 insertions(+), 24 deletions(-) create mode 100644 ComputerShopGuarantorApp/Views/Home/Assemblies.cshtml create mode 100644 ComputerShopGuarantorApp/Views/Home/Assembly.cshtml create mode 100644 ComputerShopGuarantorApp/Views/Home/Component.cshtml create mode 100644 ComputerShopGuarantorApp/Views/Home/Components.cshtml create mode 100644 ComputerShopGuarantorApp/Views/Home/Enter.cshtml create mode 100644 ComputerShopGuarantorApp/Views/Home/Register.cshtml diff --git a/ComputerShopGuarantorApp/ApiUser.cs b/ComputerShopGuarantorApp/ApiUser.cs index d03f794..31c69ea 100644 --- a/ComputerShopGuarantorApp/ApiUser.cs +++ b/ComputerShopGuarantorApp/ApiUser.cs @@ -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")); } diff --git a/ComputerShopGuarantorApp/Controllers/HomeController.cs b/ComputerShopGuarantorApp/Controllers/HomeController.cs index 819565d..bc64c76 100644 --- a/ComputerShopGuarantorApp/Controllers/HomeController.cs +++ b/ComputerShopGuarantorApp/Controllers/HomeController.cs @@ -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 _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>($"api/component/getcomponents?userId={ApiUser.User.Id}")); + } + + /* + [HttpGet] + public ComponentViewModel? GetComponent(int ComponentId) + { + if (ApiUser.User == null) + throw new Exception("Необходима авторизация"); + + var Result = ApiUser.GetRequest($"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($"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>($"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($"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>($"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>($"api/component/getcomponents?userId={ApiUser.User.Id}"); + return View("Assembly", ApiUser.GetRequest($"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($"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($"api/user/loginguarantor?login={Login}&password={Password}"); + if (ApiUser.User == null) + { + Response.Redirect("Enter"); + } + Response.Redirect("Index"); + return; + } } } diff --git a/ComputerShopGuarantorApp/Program.cs b/ComputerShopGuarantorApp/Program.cs index 385aaf2..81f11e0 100644 --- a/ComputerShopGuarantorApp/Program.cs +++ b/ComputerShopGuarantorApp/Program.cs @@ -18,9 +18,7 @@ if (!App.Environment.IsDevelopment()) App.UseHttpsRedirection(); App.UseStaticFiles(); - App.UseRouting(); - App.UseAuthorization(); App.MapControllerRoute( diff --git a/ComputerShopGuarantorApp/Views/Home/Assemblies.cshtml b/ComputerShopGuarantorApp/Views/Home/Assemblies.cshtml new file mode 100644 index 0000000..f6eead8 --- /dev/null +++ b/ComputerShopGuarantorApp/Views/Home/Assemblies.cshtml @@ -0,0 +1,61 @@ +@using ComputerShopContracts.ViewModels + +@model List +@{ + ViewData["Title"] = "Сборки"; +} + +
+
+

Список сборок

+

Просматривайте список сборок и создавайте новые, а также выбирайте сборку для изменения или удаления

+
+ + @{ + if (Model == null) + { +

Авторизируйтесь

+ return; + } +

+ Создать сборку +

+ + + + + + + + + + + + + @foreach (var Item in Model) + { + + + + + + + + + } + +
НомерНазваниеЦенаКатегория
+ @Html.DisplayFor(ModelItem => Item.Id) + + @Html.DisplayFor(ModelItem => Item.AssemblyName) + + @Html.DisplayFor(ModelItem => Item.Price) + + @Html.DisplayFor(ModelItem => Item.Category) + + + + +
+ } +
diff --git a/ComputerShopGuarantorApp/Views/Home/Assembly.cshtml b/ComputerShopGuarantorApp/Views/Home/Assembly.cshtml new file mode 100644 index 0000000..6980489 --- /dev/null +++ b/ComputerShopGuarantorApp/Views/Home/Assembly.cshtml @@ -0,0 +1,57 @@ +@using ComputerShopDataModels.Enums; +@using ComputerShopContracts.ViewModels; + +@model AssemblyViewModel + +@{ + ViewData["Title"] = "Сборка"; +} + +
+
+ @if (Model == null) + { +

Создание сборки

+ } + else + { +

Редактирование сборки

+ } +
+ +
+
+ + +
+ +
+ + +
+ +
+ + +
+ +
+ + +
+ +
+
+
+ +
+
+
+
diff --git a/ComputerShopGuarantorApp/Views/Home/Component.cshtml b/ComputerShopGuarantorApp/Views/Home/Component.cshtml new file mode 100644 index 0000000..9348afe --- /dev/null +++ b/ComputerShopGuarantorApp/Views/Home/Component.cshtml @@ -0,0 +1,40 @@ +@using ComputerShopDataModels.Enums; +@using ComputerShopContracts.ViewModels; + +@model ComponentViewModel + +@{ + ViewData["Title"] = "Комплектующая"; +} + +
+
+ @if (Model == null) + { +

Создание комплектующей

+ } + else + { +

Редактирование комплектующей

+ } +
+ +
+
+ + +
+ +
+ + +
+ +
+
+
+ +
+
+
+
diff --git a/ComputerShopGuarantorApp/Views/Home/Components.cshtml b/ComputerShopGuarantorApp/Views/Home/Components.cshtml new file mode 100644 index 0000000..3820789 --- /dev/null +++ b/ComputerShopGuarantorApp/Views/Home/Components.cshtml @@ -0,0 +1,57 @@ +@using ComputerShopContracts.ViewModels + +@model List +@{ + ViewData["Title"] = "Комплектующие"; +} + +
+
+

Список комплектующих

+

Просматривайте список комплектующих и добавляйте новые, а также выбирайте комплектующую для изменения или удаления

+
+ + @{ + if (Model == null) + { +

Авторизируйтесь

+ return; + } +

+ Создать комплектующую +

+ + + + + + + + + + + + @foreach (var Item in Model) + { + + + + + + + + } + +
НомерНаименованиеСтоимость
+ @Html.DisplayFor(ModelItem => Item.Id) + + @Html.DisplayFor(ModelItem => Item.ComponentName) + + @Html.DisplayFor(ModelItem => Item.Cost) + + + + +
+ } +
diff --git a/ComputerShopGuarantorApp/Views/Home/Enter.cshtml b/ComputerShopGuarantorApp/Views/Home/Enter.cshtml new file mode 100644 index 0000000..c1e7068 --- /dev/null +++ b/ComputerShopGuarantorApp/Views/Home/Enter.cshtml @@ -0,0 +1,54 @@ +@{ + ViewData["Title"] = "Вход"; +} + +
+
+

Вход в аккаунт

+

Войдите в ваш аккаунт чтобы иметь доступ к комплектующим, сборкам и товарам

+
+ +
+
+
+
+
+ +

Вход

+
+ +
+ +
+ + +
+ + +
+ + +
+ +
+
+ +
+
+ + +
+
+

Забыли пароль?

+
+
+ +
+ +
+
+
+
+
+
+
diff --git a/ComputerShopGuarantorApp/Views/Home/Register.cshtml b/ComputerShopGuarantorApp/Views/Home/Register.cshtml new file mode 100644 index 0000000..a1c1b89 --- /dev/null +++ b/ComputerShopGuarantorApp/Views/Home/Register.cshtml @@ -0,0 +1,60 @@ +@{ + ViewData["Title"] = "Регистрация"; +} + +
+
+

Регистрация аккаунта

+

Зарегистрируйте аккаунт поручителя, чтобы управлять комплектующими, сборками и товарами

+
+ +
+
+
+
+
+ +

Регистрация

+
+ +
+ +
+ + +
+ + +
+ + +
+ + +
+ + +
+ +
+
+ +
+
+ + +
+
+

Забыли пароль?

+
+
+ +
+ +
+
+
+
+
+
+
diff --git a/ComputerShopGuarantorApp/Views/Shared/_Layout.cshtml b/ComputerShopGuarantorApp/Views/Shared/_Layout.cshtml index c77bae2..e3e9b14 100644 --- a/ComputerShopGuarantorApp/Views/Shared/_Layout.cshtml +++ b/ComputerShopGuarantorApp/Views/Shared/_Layout.cshtml @@ -5,14 +5,18 @@ @ViewData["Title"] - Поручитель + - +
-