This commit is contained in:
Илья Федотов 2024-04-29 23:20:48 +04:00
parent 8551235414
commit f9c768037d
12 changed files with 186 additions and 24 deletions

View File

@ -18,7 +18,5 @@ namespace ElectronicsShopContracts.BindingModels
public string ProductName { get; set; } = string.Empty; public string ProductName { get; set; } = string.Empty;
public double Price { get; set; } public double Price { get; set; }
public int Count { get; set; }
} }
} }

View File

@ -20,8 +20,5 @@ namespace ElectronicsShopContracts.ViewModels
[DisplayName("Цена")] [DisplayName("Цена")]
public double Price { get; set; } public double Price { get; set; }
[DisplayName("Количество")]
public int Count { get; set; }
} }
} }

View File

@ -18,8 +18,6 @@ namespace ElectronicsShopDataBaseImplement.Models
[Required] [Required]
public double Price { get; set; } public double Price { get; set; }
[Required] [Required]
public int Count { get; set; }
[Required]
public int CategoryID { get; set; } public int CategoryID { get; set; }
public static Product? Create(ProductBindingModel? model) public static Product? Create(ProductBindingModel? model)
@ -33,7 +31,6 @@ namespace ElectronicsShopDataBaseImplement.Models
ID = model.ID, ID = model.ID,
ProductName = model.ProductName, ProductName = model.ProductName,
Price = model.Price, Price = model.Price,
Count = model.Count,
CategoryID = model.CategoryID CategoryID = model.CategoryID
}; };
} }
@ -44,7 +41,6 @@ namespace ElectronicsShopDataBaseImplement.Models
ID = model.ID, ID = model.ID,
ProductName = model.ProductName, ProductName = model.ProductName,
Price = model.Price, Price = model.Price,
Count = model.Count,
CategoryID = model.CategoryID CategoryID = model.CategoryID
}; };
} }
@ -56,7 +52,6 @@ namespace ElectronicsShopDataBaseImplement.Models
} }
ProductName = model.ProductName; ProductName = model.ProductName;
Price = model.Price; Price = model.Price;
Count = model.Count;
CategoryID = model.CategoryID; CategoryID = model.CategoryID;
} }
@ -65,7 +60,6 @@ namespace ElectronicsShopDataBaseImplement.Models
ID = ID, ID = ID,
ProductName = ProductName, ProductName = ProductName,
Price = Price, Price = Price,
Count = Count,
CategoryID = CategoryID CategoryID = CategoryID
}; };
} }

View File

@ -10,7 +10,6 @@ namespace ElectronicsShopDataModels.Models
{ {
string ProductName { get; } string ProductName { get; }
double Price { get; } double Price { get; }
int Count { get; }
int CategoryID { get; } int CategoryID { get; }
} }
} }

View File

@ -6,4 +6,8 @@
<ImplicitUsings>enable</ImplicitUsings> <ImplicitUsings>enable</ImplicitUsings>
</PropertyGroup> </PropertyGroup>
<ItemGroup>
<ProjectReference Include="..\ElectronicsShopContracts\ElectronicsShopContracts.csproj" />
</ItemGroup>
</Project> </Project>

View File

@ -0,0 +1,26 @@
@{
ViewData["Title"] = "Create";
}
<div class="text-center">
<h2 class="display-4">Создание заказа</h2>
</div>
<form method="post">
<table class="table">
<div class="row">
<div class="col-4">Продукт:</div>
<div class="col-8"></div>
</div>
<div class="row">
<div class="col-4">Количество:</div>
<div class="col-8"><input type="text" name="count" id="count" /></div>
</div>
<div class="row">
<div class="col-4">Сумма:</div>
<div class="col-8"><input type="text" id="sum" name="sum" readonly /></div>
</div>
<div class="row">
<div class="col-8"></div>
<div class="col-4"><input type="submit" value="Создать" class="btn btn-primary" /></div>
</div>
</table>
</form>

View File

@ -0,0 +1,30 @@
@{
ViewData["Title"] = "Create";
}
<div class="text-center">
<h2 class="display-4">Создание Товара</h2>
</div>
<form method="post">
<div class="row">
<div class="col-4">Товар:</div>
<div class="col-8">
<select id="product" name="product" class="form-control" asp-items="@(new SelectList(@ViewBag.Products,"ID", "ProductName"))"></select>
</div>
</div>
<div class="row">
<div class="col-8"></div>
<div class="col-8"><input type="text" name="Name" id="Name" /></div>
</div>
<div class="row">
<div class="col-4">Сумма:</div>
<div class="col-8"><input type="text" id="sum" name="sum" readonly /></div>
</div>
<div class="row">
<div class="col-4">Сумма:</div>
<div class="col-8"><input type="text" id="Category" name="Category" readonly /></div>
</div>
<div class="row">
<div class="col-8"></div>
<div class="col-4"><input type="submit" value="Создать" class="btn btn-primary" /></div>
</div>
</form>

View File

@ -0,0 +1,21 @@
@{
ViewData["Title"] = "Enter";
}
<div class="text-center">
<h2 class="display-4">Вход в приложение</h2>
</div>
<form method="post">
<div class="row">
<div class="col-4">Логин:</div>
<div class="col-8"><input type="text" name="login" /></div>
</div>
<div class="row">
<div class="col-4">Пароль:</div>
<div class="col-8"><input type="password" name="password" /></div>
</div>
<div class="row">
<div class="col-8"></div>
<div class="col-4"><input type="submit" value="Вход" class="btn btn-primary" /></div>
</div>
</form>

View File

@ -1,8 +1,44 @@
@{ @using ElectronicsShopContracts.ViewModels
ViewData["Title"] = "Home Page";
@model List<ProductViewModel>
@{
ViewData["Title"] = "Home Page";
} }
<div class="text-center"> <div class="text-center">
<h1 class="display-4">Welcome</h1> <h1 class="display-4">Заказы</h1>
<p>Learn about <a href="https://learn.microsoft.com/aspnet/core">building Web apps with ASP.NET Core</a>.</p> </div>
<div class="text-center">
@{
if (Model == null) {
<h3 class="display-4">Авторизируйтесь</h3>
return;
}
<p>
<a asp-action="Create">Создать заказ</a>
</p>
<table class="table">
<thead>
<tr>
<th>
Номер
</th>
<th>
категория товара
</th>
<th>
название
</th>
<th>
цена
</th>
</tr>
</thead>
<tbody>
</tbody>
</table>
}
</div> </div>

View File

@ -1,6 +1,32 @@
@{ @using ElectronicsShopContracts.ViewModels
ViewData["Title"] = "Privacy Policy";
}
<h1>@ViewData["Title"]</h1>
<p>Use this page to detail your site's privacy policy.</p> @model UserViewModel
@{
ViewData["Title"] = "Privacy Policy";
}
<div class="text-center">
<h2 class="display-4">Личные данные</h2>
</div>
<form method="post">
<div class="row">
<div class="col-4">Логин:</div>
<div class="col-8"><input type="text" name="login" value="@Model.Email"/></div>
</div>
<div class="row">
<div class="col-4">Пароль:</div>
<div class="col-8"><input type="password" name="password" value="@Model.Password"/></div>
</div>
<div class="row">
<div class="col-4">Пароль:</div>
<div class="col-8"><input type="text" name="phone number" value="@Model.PhoneNumber"/></div>
</div>
<div class="row">
<div class="col-4">логин:</div>
<div class="col-8"><input type="text" name="fio" value="@Model.Login"/></div>
</div>
<div class="row">
<div class="col-8"></div>
<div class="col-4"><input type="submit" value="Сохранить" class="btn btn-primary" /></div>
</div>
</form>

View File

@ -0,0 +1,25 @@
@{
ViewData["Title"] = "Register";
}
<div class="text-center">
<h2 class="display-4">Регистрация</h2>
</div>
<form method="post">
<div class="row">
<div class="col-4">Логин:</div>
<div class="col-8"><input type="text" name="login" /></div>
</div>
<div class="row">
<div class="col-4">Пароль:</div>
<div class="col-8"><input type="password" name="password" /></div>
</div>
<div class="row">
<div class="col-4">ФИО:</div>
<div class="col-8"><input type="text" name="fio" /></div>
</div>
<div class="row">
<div class="col-8"></div>
<div class="col-4"><input type="submit" value="Регистрация" class="btn btn-primary" /></div>
</div>
</form>

View File

@ -17,13 +17,19 @@
aria-expanded="false" aria-label="Toggle navigation"> aria-expanded="false" aria-label="Toggle navigation">
<span class="navbar-toggler-icon"></span> <span class="navbar-toggler-icon"></span>
</button> </button>
<div class="navbar-collapse collapse d-sm-inline-flex justify-content-between"> <div class="navbar-collapse collapse d-sm-inline-flex flex-sm-row-reverse">
<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="Home" asp-action="Index">Home</a> <a class="nav-link text-dark" asp-area="" asp-controller="Home" asp-action="Index">Заказы</a>
</li> </li>
<li class="nav-item"> <li class="nav-item">
<a class="nav-link text-dark" asp-area="" asp-controller="Home" asp-action="Privacy">Privacy</a> <a class="nav-link text-dark" asp-area="" asp-controller="Home" asp-action="Privacy">Личные данные</a>
</li>
<li class="nav-item">
<a class="nav-link text-dark" asp-area="" asp-controller="Home" asp-action="Enter">Вход</a>
</li>
<li class="nav-item">
<a class="nav-link text-dark" asp-area="" asp-controller="Home" asp-action="Register">Регистрация</a>
</li> </li>
</ul> </ul>
</div> </div>