сделано
This commit is contained in:
parent
712d1564e7
commit
72f26c94f0
@ -10,14 +10,16 @@ namespace SushiBarClientApp
|
|||||||
public class APIClient
|
public class APIClient
|
||||||
{
|
{
|
||||||
private static readonly HttpClient _client = new();
|
private static readonly HttpClient _client = new();
|
||||||
public static ClientViewModel? Client { get; set; } = null;
|
|
||||||
|
public static string? Password { get; set; }
|
||||||
|
|
||||||
public static void Connect(IConfiguration configuration)
|
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.Clear();
|
||||||
_client.DefaultRequestHeaders.Accept.Add(new
|
_client.DefaultRequestHeaders.Accept.Add(new MediaTypeWithQualityHeaderValue("application/json"));
|
||||||
MediaTypeWithQualityHeaderValue("application/json"));
|
|
||||||
}
|
}
|
||||||
|
|
||||||
public static T? GetRequest<T>(string requestUrl)
|
public static T? GetRequest<T>(string requestUrl)
|
||||||
{
|
{
|
||||||
var response = _client.GetAsync(requestUrl);
|
var response = _client.GetAsync(requestUrl);
|
||||||
@ -31,12 +33,24 @@ namespace SushiBarClientApp
|
|||||||
throw new Exception(result);
|
throw new Exception(result);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
public static void PostRequest<T>(string requestUrl, T model)
|
public static void PostRequest<T>(string requestUrl, T model)
|
||||||
{
|
{
|
||||||
var json = JsonConvert.SerializeObject(model);
|
var json = JsonConvert.SerializeObject(model);
|
||||||
var data = new StringContent(json, Encoding.UTF8,
|
var data = new StringContent(json, Encoding.UTF8, "application/json");
|
||||||
"application/json");
|
|
||||||
var response = _client.PostAsync(requestUrl, data);
|
var response = _client.PostAsync(requestUrl, data);
|
||||||
|
|
||||||
|
var result = response.Result.Content.ReadAsStringAsync().Result;
|
||||||
|
if (!response.Result.IsSuccessStatusCode)
|
||||||
|
{
|
||||||
|
throw new Exception(result);
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
public static void DeleteRequest(string requestUrl)
|
||||||
|
{
|
||||||
|
var response = _client.DeleteAsync(requestUrl);
|
||||||
var result = response.Result.Content.ReadAsStringAsync().Result;
|
var result = response.Result.Content.ReadAsStringAsync().Result;
|
||||||
if (!response.Result.IsSuccessStatusCode)
|
if (!response.Result.IsSuccessStatusCode)
|
||||||
{
|
{
|
||||||
@ -44,5 +58,5 @@ namespace SushiBarClientApp
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -11,143 +11,142 @@ namespace SushiBarClientApp.Controllers
|
|||||||
public class HomeController : Controller
|
public class HomeController : Controller
|
||||||
{
|
{
|
||||||
private readonly ILogger<HomeController> _logger;
|
private readonly ILogger<HomeController> _logger;
|
||||||
|
|
||||||
public HomeController(ILogger<HomeController> logger)
|
public HomeController(ILogger<HomeController> logger)
|
||||||
{
|
{
|
||||||
_logger = logger;
|
_logger = logger;
|
||||||
}
|
}
|
||||||
|
|
||||||
public IActionResult Index()
|
public IActionResult Index()
|
||||||
{
|
{
|
||||||
if (APIClient.Client == null)
|
if (APIClient.Password == null)
|
||||||
{
|
{
|
||||||
return Redirect("~/Home/Enter");
|
return Redirect("~/Home/Enter");
|
||||||
}
|
}
|
||||||
return
|
return View(APIClient.GetRequest<List<ShopViewModel>>($"api/shop/getshoplist?password={APIClient.Password}"));
|
||||||
View(APIClient.GetRequest<List<OrderViewModel>>($"api/main/getorders?clientId={APIClient.Client.Id}"));
|
|
||||||
}
|
|
||||||
[HttpGet]
|
|
||||||
public IActionResult Privacy()
|
|
||||||
{
|
|
||||||
if (APIClient.Client == null)
|
|
||||||
{
|
|
||||||
return Redirect("~/Home/Enter");
|
|
||||||
}
|
|
||||||
return View(APIClient.Client);
|
|
||||||
}
|
|
||||||
[HttpPost]
|
|
||||||
public void Privacy(string login, string password, string fio)
|
|
||||||
{
|
|
||||||
if (APIClient.Client == null)
|
|
||||||
{
|
|
||||||
throw new Exception("Вы как суда попали? Суда вход только авторизованным");
|
|
||||||
}
|
|
||||||
if (string.IsNullOrEmpty(login) ||
|
|
||||||
string.IsNullOrEmpty(password) || string.IsNullOrEmpty(fio))
|
|
||||||
{
|
|
||||||
throw new Exception("Введите логин, пароль и ФИО");
|
|
||||||
}
|
|
||||||
APIClient.PostRequest("api/client/updatedata", new
|
|
||||||
ClientBindingModel
|
|
||||||
{
|
|
||||||
Id = APIClient.Client.Id,
|
|
||||||
ClientFIO = fio,
|
|
||||||
Email = login,
|
|
||||||
Password = password
|
|
||||||
});
|
|
||||||
APIClient.Client.ClientFIO = fio;
|
|
||||||
APIClient.Client.Email = login;
|
|
||||||
APIClient.Client.Password = password;
|
|
||||||
Response.Redirect("Index");
|
|
||||||
}
|
|
||||||
[ResponseCache(Duration = 0, Location = ResponseCacheLocation.None,
|
|
||||||
NoStore = true)]
|
|
||||||
public IActionResult Error()
|
|
||||||
{
|
|
||||||
return View(new ErrorViewModel
|
|
||||||
{
|
|
||||||
RequestId =
|
|
||||||
Activity.Current?.Id ?? HttpContext.TraceIdentifier
|
|
||||||
});
|
|
||||||
}
|
}
|
||||||
|
|
||||||
[HttpGet]
|
[HttpGet]
|
||||||
public IActionResult Enter()
|
public IActionResult Enter()
|
||||||
{
|
{
|
||||||
return View();
|
return View();
|
||||||
}
|
}
|
||||||
|
|
||||||
[HttpPost]
|
[HttpPost]
|
||||||
public void Enter(string login, string password)
|
public void Enter(string password)
|
||||||
{
|
{
|
||||||
if (string.IsNullOrEmpty(login) ||
|
bool resout = APIClient.GetRequest<bool>($"/api/shop/authentication?password={password}");
|
||||||
string.IsNullOrEmpty(password))
|
if (!resout)
|
||||||
{
|
{
|
||||||
throw new Exception("Введите логин и пароль");
|
Response.Redirect("../Home/Enter");
|
||||||
}
|
|
||||||
APIClient.Client =
|
|
||||||
APIClient.GetRequest<ClientViewModel>($"api/client/login?login={login}&password={password}");
|
|
||||||
if (APIClient.Client == null)
|
|
||||||
{
|
|
||||||
throw new Exception("Неверный логин/пароль");
|
|
||||||
}
|
|
||||||
Response.Redirect("Index");
|
|
||||||
}
|
|
||||||
[HttpGet]
|
|
||||||
public IActionResult Register()
|
|
||||||
{
|
|
||||||
return View();
|
|
||||||
}
|
|
||||||
[HttpPost]
|
|
||||||
public void Register(string login, string password, string fio)
|
|
||||||
{
|
|
||||||
if (string.IsNullOrEmpty(login) ||
|
|
||||||
string.IsNullOrEmpty(password) || string.IsNullOrEmpty(fio))
|
|
||||||
{
|
|
||||||
throw new Exception("Введите логин, пароль и ФИО");
|
|
||||||
}
|
|
||||||
APIClient.PostRequest("api/client/register", new
|
|
||||||
ClientBindingModel
|
|
||||||
{
|
|
||||||
ClientFIO = fio,
|
|
||||||
Email = login,
|
|
||||||
Password = password
|
|
||||||
});
|
|
||||||
Response.Redirect("Enter");
|
|
||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
|
APIClient.Password = password;
|
||||||
|
Response.Redirect("Index");
|
||||||
|
}
|
||||||
|
|
||||||
[HttpGet]
|
[HttpGet]
|
||||||
public IActionResult Create()
|
public IActionResult Create()
|
||||||
{
|
{
|
||||||
ViewBag.Sushis =
|
if (APIClient.Password == null)
|
||||||
APIClient.GetRequest<List<SushiViewModel>>("api/main/getsushilist");
|
{
|
||||||
return View();
|
return Redirect("~/Home/Enter");
|
||||||
}
|
}
|
||||||
|
return View("Shop");
|
||||||
|
}
|
||||||
|
|
||||||
[HttpPost]
|
[HttpPost]
|
||||||
public void Create(int sushi, int count)
|
public void Create(int id, string shopname, string adress, DateTime openingdate, int maxcount)
|
||||||
{
|
{
|
||||||
if (APIClient.Client == null)
|
if (string.IsNullOrEmpty(shopname) || string.IsNullOrEmpty(adress))
|
||||||
{
|
{
|
||||||
throw new Exception("Вы как суда попали? Суда вход только авторизованным");
|
throw new Exception("Название или адрес не может быть пустым");
|
||||||
}
|
}
|
||||||
if (count <= 0)
|
if (openingdate == default(DateTime))
|
||||||
{
|
{
|
||||||
throw new Exception("Количество и сумма должны быть больше 0");
|
throw new Exception("Дата открытия не может быть пустой");
|
||||||
}
|
}
|
||||||
APIClient.PostRequest("api/main/createorder", new OrderBindingModel
|
|
||||||
|
APIClient.PostRequest($"api/shop/createshop?password={APIClient.Password}", new ShopBindingModel
|
||||||
{
|
{
|
||||||
ClientId = APIClient.Client.Id,
|
Id = id,
|
||||||
SushiId = sushi,
|
ShopName = shopname,
|
||||||
Count = count,
|
Adress = adress,
|
||||||
Sum = Calc(count, sushi)
|
OpeningDate = openingdate,
|
||||||
|
SushiMaxCount = maxcount
|
||||||
});
|
});
|
||||||
Response.Redirect("Index");
|
Response.Redirect("Index");
|
||||||
}
|
}
|
||||||
[HttpPost]
|
|
||||||
public double Calc(int count, int sushi)
|
[HttpGet]
|
||||||
|
public IActionResult Update(int Id)
|
||||||
{
|
{
|
||||||
var prod =
|
if (APIClient.Password == null)
|
||||||
APIClient.GetRequest<SushiViewModel>($"api/main/getsushi?sushiId={sushi}"
|
{
|
||||||
);
|
return Redirect("~/Home/Enter");
|
||||||
return count * (prod?.Price ?? 1);
|
}
|
||||||
|
return View("Shop", APIClient.GetRequest<ShopSushiViewModel>($"api/shop/getshop?shopId={Id}&password={APIClient.Password}"));
|
||||||
|
}
|
||||||
|
|
||||||
|
[HttpPost]
|
||||||
|
public void Update(int id, string shopname, string adress, DateTime openingdate, int maxcount)
|
||||||
|
{
|
||||||
|
if (string.IsNullOrEmpty(shopname) || string.IsNullOrEmpty(adress))
|
||||||
|
{
|
||||||
|
throw new Exception("Название или адрес не может быть пустым");
|
||||||
|
}
|
||||||
|
if (openingdate == default(DateTime))
|
||||||
|
{
|
||||||
|
throw new Exception("Дата открытия не может быть пустой");
|
||||||
|
}
|
||||||
|
APIClient.PostRequest($"api/shop/updateshop?password={APIClient.Password}", new ShopBindingModel
|
||||||
|
{
|
||||||
|
Id = id,
|
||||||
|
ShopName = shopname,
|
||||||
|
Adress = adress,
|
||||||
|
OpeningDate = openingdate,
|
||||||
|
SushiMaxCount = maxcount
|
||||||
|
});
|
||||||
|
Response.Redirect("../Index");
|
||||||
|
}
|
||||||
|
|
||||||
|
[HttpPost]
|
||||||
|
public void Delete(int Id)
|
||||||
|
{
|
||||||
|
APIClient.DeleteRequest($"api/shop/deleteshop?shopId={Id}&password={APIClient.Password}");
|
||||||
|
Response.Redirect("../Index");
|
||||||
|
}
|
||||||
|
|
||||||
|
[HttpGet]
|
||||||
|
public IActionResult Supply()
|
||||||
|
{
|
||||||
|
if (APIClient.Password == null)
|
||||||
|
{
|
||||||
|
return Redirect("~/Home/Enter");
|
||||||
|
}
|
||||||
|
|
||||||
|
ViewBag.Shops = APIClient.GetRequest<List<ShopViewModel>>($"api/shop/getshoplist?password={APIClient.Password}");
|
||||||
|
ViewBag.Sushis = APIClient.GetRequest<List<SushiViewModel>>($"api/main/getsushilist");
|
||||||
|
return View();
|
||||||
|
}
|
||||||
|
|
||||||
|
[HttpPost]
|
||||||
|
public void Supply(int shop, int sushi, int count)
|
||||||
|
{
|
||||||
|
APIClient.PostRequest($"api/shop/makesypply?password={APIClient.Password}", new SupplyBindingModel
|
||||||
|
{
|
||||||
|
ShopId = shop,
|
||||||
|
SushiId = sushi,
|
||||||
|
Count = count
|
||||||
|
});
|
||||||
|
Response.Redirect("Index");
|
||||||
|
}
|
||||||
|
|
||||||
|
[ResponseCache(Duration = 0, Location = ResponseCacheLocation.None, NoStore = true)]
|
||||||
|
public IActionResult Error()
|
||||||
|
{
|
||||||
|
return View(new ErrorViewModel { RequestId = Activity.Current?.Id ?? HttpContext.TraceIdentifier });
|
||||||
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
}
|
|
||||||
|
|
||||||
|
@ -1,27 +1,21 @@
|
|||||||
@using SushiBarContracts.ViewModels
|
@using SushiBarContracts.ViewModels
|
||||||
|
|
||||||
@model List<OrderViewModel>
|
@model List<ShopViewModel>
|
||||||
|
|
||||||
@{
|
@{
|
||||||
ViewData["Title"] = "Home Page";
|
ViewData["Title"] = "Home Page";
|
||||||
}
|
}
|
||||||
|
|
||||||
<div class="text-center">
|
<div class="text-center">
|
||||||
<h1 class="display-4">Заказы</h1>
|
<h1 class="display-4">Магазины</h1>
|
||||||
</div>
|
</div>
|
||||||
|
|
||||||
|
|
||||||
<div class="text-center ">
|
<div class="text-center ">
|
||||||
@{
|
|
||||||
if (Model == null)
|
|
||||||
{
|
|
||||||
<h3 class="display-4">Авторизируйтесь</h3>
|
|
||||||
return;
|
|
||||||
}
|
|
||||||
|
|
||||||
<p>
|
<p>
|
||||||
<a asp-action="Create">Создать заказ</a>
|
<a asp-action="Create">Создать магазин</a>
|
||||||
</p>
|
</p>
|
||||||
|
|
||||||
<table class="table">
|
<table class="table">
|
||||||
<thead>
|
<thead>
|
||||||
<tr>
|
<tr>
|
||||||
@ -29,19 +23,19 @@
|
|||||||
Номер
|
Номер
|
||||||
</th>
|
</th>
|
||||||
<th>
|
<th>
|
||||||
Суши
|
Название
|
||||||
</th>
|
</th>
|
||||||
<th>
|
<th>
|
||||||
Дата создания
|
Адрес
|
||||||
</th>
|
</th>
|
||||||
<th>
|
<th>
|
||||||
Количество
|
Дата открытия
|
||||||
</th>
|
</th>
|
||||||
<th>
|
<th>
|
||||||
Сумма
|
Максимальная вместимость
|
||||||
</th>
|
</th>
|
||||||
<th>
|
<th>
|
||||||
Статус
|
|
||||||
</th>
|
</th>
|
||||||
</tr>
|
</tr>
|
||||||
</thead>
|
</thead>
|
||||||
@ -53,23 +47,22 @@
|
|||||||
@Html.DisplayFor(modelItem => item.Id)
|
@Html.DisplayFor(modelItem => item.Id)
|
||||||
</td>
|
</td>
|
||||||
<td>
|
<td>
|
||||||
@Html.DisplayFor(modelItem => item.SushiName)
|
@Html.DisplayFor(modelItem => item.ShopName)
|
||||||
</td>
|
</td>
|
||||||
<td>
|
<td>
|
||||||
@Html.DisplayFor(modelItem => item.DateCreate)
|
@Html.DisplayFor(modelItem => item.Adress)
|
||||||
</td>
|
</td>
|
||||||
<td>
|
<td>
|
||||||
@Html.DisplayFor(modelItem => item.Count)
|
@Html.DisplayFor(modelItem => item.OpeningDate)
|
||||||
</td>
|
</td>
|
||||||
<td>
|
<td>
|
||||||
@Html.DisplayFor(modelItem => item.Sum)
|
@Html.DisplayFor(modelItem => item.SushiMaxCount)
|
||||||
</td>
|
</td>
|
||||||
<td>
|
<td>
|
||||||
@Html.DisplayFor(modelItem => item.Status)
|
<a class="btn btn-primary" asp-action="Update" asp-route-Id="@(item.Id)" role="button">Изменить</a>
|
||||||
</td>
|
</td>
|
||||||
</tr>
|
</tr>
|
||||||
}
|
}
|
||||||
</tbody>
|
</tbody>
|
||||||
</table>
|
</table>
|
||||||
}
|
|
||||||
</div>
|
</div>
|
74
SushiBar/SushiBarClientApp/Views/Home/Shop.cshtml
Normal file
74
SushiBar/SushiBarClientApp/Views/Home/Shop.cshtml
Normal file
@ -0,0 +1,74 @@
|
|||||||
|
@using SushiBarDataModels.Models;
|
||||||
|
@using SushiBarContracts.ViewModels;
|
||||||
|
@model ShopSushiViewModel
|
||||||
|
|
||||||
|
@{
|
||||||
|
ViewData["Title"] = "Shop";
|
||||||
|
}
|
||||||
|
|
||||||
|
<div class="text-center">
|
||||||
|
@{
|
||||||
|
if (Model == null)
|
||||||
|
{
|
||||||
|
<h2 class="display-4">Создание магазина</h2>
|
||||||
|
}
|
||||||
|
else
|
||||||
|
{
|
||||||
|
<h2 class="display-4">Изменение магазина</h2>
|
||||||
|
}
|
||||||
|
}
|
||||||
|
</div>
|
||||||
|
|
||||||
|
<form method="post">
|
||||||
|
<div class="mb-3">
|
||||||
|
<label class="form-label">Название</label>
|
||||||
|
<input type="text" class="form-control" name="shopname" id="shopname" value="@(Model==null ? "" : Model.Shop?.ShopName)" />
|
||||||
|
</div>
|
||||||
|
<div class="mb-3">
|
||||||
|
<label class="form-label">Адрес</label>
|
||||||
|
<input type="text" class="form-control" name="adress" id="adress" value="@(Model==null ? "" : Model.Shop?.Adress)" />
|
||||||
|
</div>
|
||||||
|
<div class="mb-3">
|
||||||
|
<label for="startDate">Дата открытия</label>
|
||||||
|
<input class="form-control" type="date" name="openingdate" id="openingdate" value="@(Model==null ? "" : Model.Shop?.OpeningDate.ToString("yyyy-MM-dd"))" />
|
||||||
|
</div>
|
||||||
|
<div class="mb-3">
|
||||||
|
<label class="form-label">Вместимость</label>
|
||||||
|
<input type="number" min="0" step="1" pattern="[0-9]" class="form-control" name="maxcount" id="maxcount" value="@(Model==null ? "" : Model.Shop?.SushiMaxCount)" />
|
||||||
|
</div>
|
||||||
|
<div class="mb-3 ">
|
||||||
|
<input class="btn btn-primary" type="submit" value="Сохранить">
|
||||||
|
@{
|
||||||
|
if (Model != null && Model.Shop != null)
|
||||||
|
{
|
||||||
|
<input class="btn btn-danger" asp-action="Delete" type="submit" value="Удалить" asp-route-Id="@(Model==null ? 0 : Model.Shop.Id.ToString())">
|
||||||
|
}
|
||||||
|
}
|
||||||
|
</div>
|
||||||
|
</form>
|
||||||
|
@{
|
||||||
|
if (Model != null && Model.Shop != null)
|
||||||
|
{
|
||||||
|
<div>
|
||||||
|
<h6>Содержимое магазина</h6>
|
||||||
|
</div>
|
||||||
|
<table class="table">
|
||||||
|
<thead>
|
||||||
|
<tr>
|
||||||
|
<th>Название</th>
|
||||||
|
<th>Количество</th>
|
||||||
|
</tr>
|
||||||
|
</thead>
|
||||||
|
<tbody>
|
||||||
|
@foreach (var item in Model.ShopSushi)
|
||||||
|
{
|
||||||
|
<tr>
|
||||||
|
<td>@Html.DisplayFor(modelItem => item.Value.Sushi.SushiName)</td>
|
||||||
|
<td>@Html.DisplayFor(modelItem => item.Value.Count)</td>
|
||||||
|
</tr>
|
||||||
|
}
|
||||||
|
</tbody>
|
||||||
|
|
||||||
|
</table>
|
||||||
|
}
|
||||||
|
}
|
22
SushiBar/SushiBarClientApp/Views/Home/Supply.cshtml
Normal file
22
SushiBar/SushiBarClientApp/Views/Home/Supply.cshtml
Normal file
@ -0,0 +1,22 @@
|
|||||||
|
@{
|
||||||
|
ViewData["Title"] = "Supply";
|
||||||
|
}
|
||||||
|
<div class="text-center">
|
||||||
|
<h2 class="display-4">Создание поставки</h2>
|
||||||
|
</div>
|
||||||
|
<form method="post">
|
||||||
|
<div class="mb-3">
|
||||||
|
<label class="form-label">Магазин</label>
|
||||||
|
<select class="form-select form-select-lg" id="shop" name="shop" asp-items="@(new SelectList(@ViewBag.Shops,"Id", "ShopName"))"></select>
|
||||||
|
</div>
|
||||||
|
<div class="mb-3">
|
||||||
|
<label class="form-label">Суши</label>
|
||||||
|
<select class="form-select form-select-lg" id="sushi" name="sushi" asp-items="@(new SelectList(@ViewBag.Sushis,"Id", "SushiName"))"></select>
|
||||||
|
</div>
|
||||||
|
<div class="mb-3">
|
||||||
|
<label class="form-label">Колличество</label>
|
||||||
|
<input type="number" min="0" step="1" pattern="[0-9]" class="form-control" name="count" id="count">
|
||||||
|
</div>
|
||||||
|
<input class="btn btn-success" type="submit" value="Создать поставку">
|
||||||
|
<a class="btn btn-primary" href="./Index" role="button">Отмена</a>
|
||||||
|
</form>
|
@ -14,24 +14,18 @@
|
|||||||
<header>
|
<header>
|
||||||
<nav class="navbar navbar-expand-sm navbar-toggleable-sm navbar-light bg-white border-bottom box-shadow mb-3">
|
<nav class="navbar navbar-expand-sm navbar-toggleable-sm navbar-light bg-white border-bottom box-shadow mb-3">
|
||||||
<div class="container-fluid">
|
<div class="container-fluid">
|
||||||
<a class="navbar-brand" asp-area="" asp-controller="Home" asp-action="Index">Суши-Бар</a>
|
<a class="navbar-brand" asp-area="" asp-controller="Home" asp-action="Index">PizzeriaShopsApi</a>
|
||||||
<button class="navbar-toggler" type="button" data-toggle="collapse" data-target=".navbar-collapse" aria-controls="navbarSupportedContent"
|
<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">
|
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 flex-sm-row-reverse">
|
<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="Home" asp-action="Index">Заказы</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">Личные данные</a>
|
<a class="nav-link text-dark" asp-area="" asp-controller="Home" asp-action="Supply">Поставка</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>
|
||||||
@ -46,7 +40,7 @@
|
|||||||
|
|
||||||
<footer class="border-top footer text-muted">
|
<footer class="border-top footer text-muted">
|
||||||
<div class="container">
|
<div class="container">
|
||||||
© 2024 - SushiBarClientApp - <a asp-area="" asp-controller="Home" asp-action="Privacy">Privacy</a>
|
© 2024 - SushiBarShopApp - <a asp-area="" asp-controller="Home" asp-action="Index">Главная</a>
|
||||||
</div>
|
</div>
|
||||||
</footer>
|
</footer>
|
||||||
<script src="~/lib/jquery/dist/jquery.min.js"></script>
|
<script src="~/lib/jquery/dist/jquery.min.js"></script>
|
||||||
|
14
SushiBar/SushiBarContracts/ViewModels/ShopSushiViewModel.cs
Normal file
14
SushiBar/SushiBarContracts/ViewModels/ShopSushiViewModel.cs
Normal file
@ -0,0 +1,14 @@
|
|||||||
|
using System;
|
||||||
|
using System.Collections.Generic;
|
||||||
|
using System.Linq;
|
||||||
|
using System.Text;
|
||||||
|
using System.Threading.Tasks;
|
||||||
|
|
||||||
|
namespace SushiBarContracts.ViewModels
|
||||||
|
{
|
||||||
|
public class ShopSushiViewModel
|
||||||
|
{
|
||||||
|
public ShopViewModel Shop { get; set; } = new();
|
||||||
|
public Dictionary<int, SushiCount> ShopSushi { get; set; } = new();
|
||||||
|
}
|
||||||
|
}
|
14
SushiBar/SushiBarContracts/ViewModels/SushiCount.cs
Normal file
14
SushiBar/SushiBarContracts/ViewModels/SushiCount.cs
Normal file
@ -0,0 +1,14 @@
|
|||||||
|
using System;
|
||||||
|
using System.Collections.Generic;
|
||||||
|
using System.Linq;
|
||||||
|
using System.Text;
|
||||||
|
using System.Threading.Tasks;
|
||||||
|
|
||||||
|
namespace SushiBarContracts.ViewModels
|
||||||
|
{
|
||||||
|
public class SushiCount
|
||||||
|
{
|
||||||
|
public SushiViewModel Sushi { get; set; }
|
||||||
|
public int Count { get; set; } = new();
|
||||||
|
}
|
||||||
|
}
|
291
SushiBar/SushiBarDatabaseImplement/Migrations/20240508132013_InitCreate.Designer.cs
generated
Normal file
291
SushiBar/SushiBarDatabaseImplement/Migrations/20240508132013_InitCreate.Designer.cs
generated
Normal file
@ -0,0 +1,291 @@
|
|||||||
|
// <auto-generated />
|
||||||
|
using System;
|
||||||
|
using Microsoft.EntityFrameworkCore;
|
||||||
|
using Microsoft.EntityFrameworkCore.Infrastructure;
|
||||||
|
using Microsoft.EntityFrameworkCore.Metadata;
|
||||||
|
using Microsoft.EntityFrameworkCore.Migrations;
|
||||||
|
using Microsoft.EntityFrameworkCore.Storage.ValueConversion;
|
||||||
|
using SushiBarDatabaseImplement;
|
||||||
|
|
||||||
|
#nullable disable
|
||||||
|
|
||||||
|
namespace SushiBarDatabaseImplement.Migrations
|
||||||
|
{
|
||||||
|
[DbContext(typeof(SushiBarDatabase))]
|
||||||
|
[Migration("20240508132013_InitCreate")]
|
||||||
|
partial class InitCreate
|
||||||
|
{
|
||||||
|
/// <inheritdoc />
|
||||||
|
protected override void BuildTargetModel(ModelBuilder modelBuilder)
|
||||||
|
{
|
||||||
|
#pragma warning disable 612, 618
|
||||||
|
modelBuilder
|
||||||
|
.HasAnnotation("ProductVersion", "7.0.17")
|
||||||
|
.HasAnnotation("Relational:MaxIdentifierLength", 128);
|
||||||
|
|
||||||
|
SqlServerModelBuilderExtensions.UseIdentityColumns(modelBuilder);
|
||||||
|
|
||||||
|
modelBuilder.Entity("SushiBarDatabaseImplement.Models.Client", b =>
|
||||||
|
{
|
||||||
|
b.Property<int>("Id")
|
||||||
|
.ValueGeneratedOnAdd()
|
||||||
|
.HasColumnType("int");
|
||||||
|
|
||||||
|
SqlServerPropertyBuilderExtensions.UseIdentityColumn(b.Property<int>("Id"));
|
||||||
|
|
||||||
|
b.Property<string>("ClientFIO")
|
||||||
|
.IsRequired()
|
||||||
|
.HasColumnType("nvarchar(max)");
|
||||||
|
|
||||||
|
b.Property<string>("Email")
|
||||||
|
.IsRequired()
|
||||||
|
.HasColumnType("nvarchar(max)");
|
||||||
|
|
||||||
|
b.Property<string>("Password")
|
||||||
|
.IsRequired()
|
||||||
|
.HasColumnType("nvarchar(max)");
|
||||||
|
|
||||||
|
b.HasKey("Id");
|
||||||
|
|
||||||
|
b.ToTable("Clients");
|
||||||
|
});
|
||||||
|
|
||||||
|
modelBuilder.Entity("SushiBarDatabaseImplement.Models.Component", b =>
|
||||||
|
{
|
||||||
|
b.Property<int>("Id")
|
||||||
|
.ValueGeneratedOnAdd()
|
||||||
|
.HasColumnType("int");
|
||||||
|
|
||||||
|
SqlServerPropertyBuilderExtensions.UseIdentityColumn(b.Property<int>("Id"));
|
||||||
|
|
||||||
|
b.Property<string>("ComponentName")
|
||||||
|
.IsRequired()
|
||||||
|
.HasColumnType("nvarchar(max)");
|
||||||
|
|
||||||
|
b.Property<double>("Cost")
|
||||||
|
.HasColumnType("float");
|
||||||
|
|
||||||
|
b.HasKey("Id");
|
||||||
|
|
||||||
|
b.ToTable("Components");
|
||||||
|
});
|
||||||
|
|
||||||
|
modelBuilder.Entity("SushiBarDatabaseImplement.Models.Order", b =>
|
||||||
|
{
|
||||||
|
b.Property<int>("Id")
|
||||||
|
.ValueGeneratedOnAdd()
|
||||||
|
.HasColumnType("int");
|
||||||
|
|
||||||
|
SqlServerPropertyBuilderExtensions.UseIdentityColumn(b.Property<int>("Id"));
|
||||||
|
|
||||||
|
b.Property<int>("ClientId")
|
||||||
|
.HasColumnType("int");
|
||||||
|
|
||||||
|
b.Property<int>("Count")
|
||||||
|
.HasColumnType("int");
|
||||||
|
|
||||||
|
b.Property<DateTime>("DateCreate")
|
||||||
|
.HasColumnType("datetime2");
|
||||||
|
|
||||||
|
b.Property<DateTime?>("DateImplement")
|
||||||
|
.HasColumnType("datetime2");
|
||||||
|
|
||||||
|
b.Property<int>("Status")
|
||||||
|
.HasColumnType("int");
|
||||||
|
|
||||||
|
b.Property<double>("Sum")
|
||||||
|
.HasColumnType("float");
|
||||||
|
|
||||||
|
b.Property<int>("SushiId")
|
||||||
|
.HasColumnType("int");
|
||||||
|
|
||||||
|
b.HasKey("Id");
|
||||||
|
|
||||||
|
b.HasIndex("ClientId");
|
||||||
|
|
||||||
|
b.HasIndex("SushiId");
|
||||||
|
|
||||||
|
b.ToTable("Orders");
|
||||||
|
});
|
||||||
|
|
||||||
|
modelBuilder.Entity("SushiBarDatabaseImplement.Models.Shop", b =>
|
||||||
|
{
|
||||||
|
b.Property<int>("Id")
|
||||||
|
.ValueGeneratedOnAdd()
|
||||||
|
.HasColumnType("int");
|
||||||
|
|
||||||
|
SqlServerPropertyBuilderExtensions.UseIdentityColumn(b.Property<int>("Id"));
|
||||||
|
|
||||||
|
b.Property<string>("Adress")
|
||||||
|
.IsRequired()
|
||||||
|
.HasColumnType("nvarchar(max)");
|
||||||
|
|
||||||
|
b.Property<DateTime>("OpeningDate")
|
||||||
|
.HasColumnType("datetime2");
|
||||||
|
|
||||||
|
b.Property<string>("ShopName")
|
||||||
|
.IsRequired()
|
||||||
|
.HasColumnType("nvarchar(max)");
|
||||||
|
|
||||||
|
b.Property<int>("SushiMaxCount")
|
||||||
|
.HasColumnType("int");
|
||||||
|
|
||||||
|
b.HasKey("Id");
|
||||||
|
|
||||||
|
b.ToTable("Shops");
|
||||||
|
});
|
||||||
|
|
||||||
|
modelBuilder.Entity("SushiBarDatabaseImplement.Models.ShopSushis", b =>
|
||||||
|
{
|
||||||
|
b.Property<int>("Id")
|
||||||
|
.ValueGeneratedOnAdd()
|
||||||
|
.HasColumnType("int");
|
||||||
|
|
||||||
|
SqlServerPropertyBuilderExtensions.UseIdentityColumn(b.Property<int>("Id"));
|
||||||
|
|
||||||
|
b.Property<int>("Count")
|
||||||
|
.HasColumnType("int");
|
||||||
|
|
||||||
|
b.Property<int>("ShopId")
|
||||||
|
.HasColumnType("int");
|
||||||
|
|
||||||
|
b.Property<int>("SushiId")
|
||||||
|
.HasColumnType("int");
|
||||||
|
|
||||||
|
b.HasKey("Id");
|
||||||
|
|
||||||
|
b.HasIndex("ShopId");
|
||||||
|
|
||||||
|
b.HasIndex("SushiId");
|
||||||
|
|
||||||
|
b.ToTable("ShopSushis");
|
||||||
|
});
|
||||||
|
|
||||||
|
modelBuilder.Entity("SushiBarDatabaseImplement.Models.Sushi", b =>
|
||||||
|
{
|
||||||
|
b.Property<int>("Id")
|
||||||
|
.ValueGeneratedOnAdd()
|
||||||
|
.HasColumnType("int");
|
||||||
|
|
||||||
|
SqlServerPropertyBuilderExtensions.UseIdentityColumn(b.Property<int>("Id"));
|
||||||
|
|
||||||
|
b.Property<double>("Price")
|
||||||
|
.HasColumnType("float");
|
||||||
|
|
||||||
|
b.Property<string>("SushiName")
|
||||||
|
.IsRequired()
|
||||||
|
.HasColumnType("nvarchar(max)");
|
||||||
|
|
||||||
|
b.HasKey("Id");
|
||||||
|
|
||||||
|
b.ToTable("Sushis");
|
||||||
|
});
|
||||||
|
|
||||||
|
modelBuilder.Entity("SushiBarDatabaseImplement.Models.SushiComponent", b =>
|
||||||
|
{
|
||||||
|
b.Property<int>("Id")
|
||||||
|
.ValueGeneratedOnAdd()
|
||||||
|
.HasColumnType("int");
|
||||||
|
|
||||||
|
SqlServerPropertyBuilderExtensions.UseIdentityColumn(b.Property<int>("Id"));
|
||||||
|
|
||||||
|
b.Property<int>("ComponentId")
|
||||||
|
.HasColumnType("int");
|
||||||
|
|
||||||
|
b.Property<int>("Count")
|
||||||
|
.HasColumnType("int");
|
||||||
|
|
||||||
|
b.Property<int>("SushiId")
|
||||||
|
.HasColumnType("int");
|
||||||
|
|
||||||
|
b.HasKey("Id");
|
||||||
|
|
||||||
|
b.HasIndex("ComponentId");
|
||||||
|
|
||||||
|
b.HasIndex("SushiId");
|
||||||
|
|
||||||
|
b.ToTable("SushiComponents");
|
||||||
|
});
|
||||||
|
|
||||||
|
modelBuilder.Entity("SushiBarDatabaseImplement.Models.Order", b =>
|
||||||
|
{
|
||||||
|
b.HasOne("SushiBarDatabaseImplement.Models.Client", "Client")
|
||||||
|
.WithMany("Orders")
|
||||||
|
.HasForeignKey("ClientId")
|
||||||
|
.OnDelete(DeleteBehavior.Cascade)
|
||||||
|
.IsRequired();
|
||||||
|
|
||||||
|
b.HasOne("SushiBarDatabaseImplement.Models.Sushi", "Sushi")
|
||||||
|
.WithMany("Orders")
|
||||||
|
.HasForeignKey("SushiId")
|
||||||
|
.OnDelete(DeleteBehavior.Cascade)
|
||||||
|
.IsRequired();
|
||||||
|
|
||||||
|
b.Navigation("Client");
|
||||||
|
|
||||||
|
b.Navigation("Sushi");
|
||||||
|
});
|
||||||
|
|
||||||
|
modelBuilder.Entity("SushiBarDatabaseImplement.Models.ShopSushis", b =>
|
||||||
|
{
|
||||||
|
b.HasOne("SushiBarDatabaseImplement.Models.Shop", "Shop")
|
||||||
|
.WithMany("Sushis")
|
||||||
|
.HasForeignKey("ShopId")
|
||||||
|
.OnDelete(DeleteBehavior.Cascade)
|
||||||
|
.IsRequired();
|
||||||
|
|
||||||
|
b.HasOne("SushiBarDatabaseImplement.Models.Sushi", "Sushi")
|
||||||
|
.WithMany()
|
||||||
|
.HasForeignKey("SushiId")
|
||||||
|
.OnDelete(DeleteBehavior.Cascade)
|
||||||
|
.IsRequired();
|
||||||
|
|
||||||
|
b.Navigation("Shop");
|
||||||
|
|
||||||
|
b.Navigation("Sushi");
|
||||||
|
});
|
||||||
|
|
||||||
|
modelBuilder.Entity("SushiBarDatabaseImplement.Models.SushiComponent", b =>
|
||||||
|
{
|
||||||
|
b.HasOne("SushiBarDatabaseImplement.Models.Component", "Component")
|
||||||
|
.WithMany("SushiComponents")
|
||||||
|
.HasForeignKey("ComponentId")
|
||||||
|
.OnDelete(DeleteBehavior.Cascade)
|
||||||
|
.IsRequired();
|
||||||
|
|
||||||
|
b.HasOne("SushiBarDatabaseImplement.Models.Sushi", "Sushi")
|
||||||
|
.WithMany("Components")
|
||||||
|
.HasForeignKey("SushiId")
|
||||||
|
.OnDelete(DeleteBehavior.Cascade)
|
||||||
|
.IsRequired();
|
||||||
|
|
||||||
|
b.Navigation("Component");
|
||||||
|
|
||||||
|
b.Navigation("Sushi");
|
||||||
|
});
|
||||||
|
|
||||||
|
modelBuilder.Entity("SushiBarDatabaseImplement.Models.Client", b =>
|
||||||
|
{
|
||||||
|
b.Navigation("Orders");
|
||||||
|
});
|
||||||
|
|
||||||
|
modelBuilder.Entity("SushiBarDatabaseImplement.Models.Component", b =>
|
||||||
|
{
|
||||||
|
b.Navigation("SushiComponents");
|
||||||
|
});
|
||||||
|
|
||||||
|
modelBuilder.Entity("SushiBarDatabaseImplement.Models.Shop", b =>
|
||||||
|
{
|
||||||
|
b.Navigation("Sushis");
|
||||||
|
});
|
||||||
|
|
||||||
|
modelBuilder.Entity("SushiBarDatabaseImplement.Models.Sushi", b =>
|
||||||
|
{
|
||||||
|
b.Navigation("Components");
|
||||||
|
|
||||||
|
b.Navigation("Orders");
|
||||||
|
});
|
||||||
|
#pragma warning restore 612, 618
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
@ -0,0 +1,214 @@
|
|||||||
|
using System;
|
||||||
|
using Microsoft.EntityFrameworkCore.Migrations;
|
||||||
|
|
||||||
|
#nullable disable
|
||||||
|
|
||||||
|
namespace SushiBarDatabaseImplement.Migrations
|
||||||
|
{
|
||||||
|
/// <inheritdoc />
|
||||||
|
public partial class InitCreate : Migration
|
||||||
|
{
|
||||||
|
/// <inheritdoc />
|
||||||
|
protected override void Up(MigrationBuilder migrationBuilder)
|
||||||
|
{
|
||||||
|
migrationBuilder.CreateTable(
|
||||||
|
name: "Clients",
|
||||||
|
columns: table => new
|
||||||
|
{
|
||||||
|
Id = table.Column<int>(type: "int", nullable: false)
|
||||||
|
.Annotation("SqlServer:Identity", "1, 1"),
|
||||||
|
ClientFIO = table.Column<string>(type: "nvarchar(max)", nullable: false),
|
||||||
|
Email = table.Column<string>(type: "nvarchar(max)", nullable: false),
|
||||||
|
Password = table.Column<string>(type: "nvarchar(max)", nullable: false)
|
||||||
|
},
|
||||||
|
constraints: table =>
|
||||||
|
{
|
||||||
|
table.PrimaryKey("PK_Clients", x => x.Id);
|
||||||
|
});
|
||||||
|
|
||||||
|
migrationBuilder.CreateTable(
|
||||||
|
name: "Components",
|
||||||
|
columns: table => new
|
||||||
|
{
|
||||||
|
Id = table.Column<int>(type: "int", nullable: false)
|
||||||
|
.Annotation("SqlServer:Identity", "1, 1"),
|
||||||
|
ComponentName = table.Column<string>(type: "nvarchar(max)", nullable: false),
|
||||||
|
Cost = table.Column<double>(type: "float", nullable: false)
|
||||||
|
},
|
||||||
|
constraints: table =>
|
||||||
|
{
|
||||||
|
table.PrimaryKey("PK_Components", x => x.Id);
|
||||||
|
});
|
||||||
|
|
||||||
|
migrationBuilder.CreateTable(
|
||||||
|
name: "Shops",
|
||||||
|
columns: table => new
|
||||||
|
{
|
||||||
|
Id = table.Column<int>(type: "int", nullable: false)
|
||||||
|
.Annotation("SqlServer:Identity", "1, 1"),
|
||||||
|
ShopName = table.Column<string>(type: "nvarchar(max)", nullable: false),
|
||||||
|
Adress = table.Column<string>(type: "nvarchar(max)", nullable: false),
|
||||||
|
OpeningDate = table.Column<DateTime>(type: "datetime2", nullable: false),
|
||||||
|
SushiMaxCount = table.Column<int>(type: "int", nullable: false)
|
||||||
|
},
|
||||||
|
constraints: table =>
|
||||||
|
{
|
||||||
|
table.PrimaryKey("PK_Shops", x => x.Id);
|
||||||
|
});
|
||||||
|
|
||||||
|
migrationBuilder.CreateTable(
|
||||||
|
name: "Sushis",
|
||||||
|
columns: table => new
|
||||||
|
{
|
||||||
|
Id = table.Column<int>(type: "int", nullable: false)
|
||||||
|
.Annotation("SqlServer:Identity", "1, 1"),
|
||||||
|
SushiName = table.Column<string>(type: "nvarchar(max)", nullable: false),
|
||||||
|
Price = table.Column<double>(type: "float", nullable: false)
|
||||||
|
},
|
||||||
|
constraints: table =>
|
||||||
|
{
|
||||||
|
table.PrimaryKey("PK_Sushis", x => x.Id);
|
||||||
|
});
|
||||||
|
|
||||||
|
migrationBuilder.CreateTable(
|
||||||
|
name: "Orders",
|
||||||
|
columns: table => new
|
||||||
|
{
|
||||||
|
Id = table.Column<int>(type: "int", nullable: false)
|
||||||
|
.Annotation("SqlServer:Identity", "1, 1"),
|
||||||
|
ClientId = table.Column<int>(type: "int", nullable: false),
|
||||||
|
SushiId = table.Column<int>(type: "int", nullable: false),
|
||||||
|
Count = table.Column<int>(type: "int", nullable: false),
|
||||||
|
Sum = table.Column<double>(type: "float", nullable: false),
|
||||||
|
Status = table.Column<int>(type: "int", nullable: false),
|
||||||
|
DateCreate = table.Column<DateTime>(type: "datetime2", nullable: false),
|
||||||
|
DateImplement = table.Column<DateTime>(type: "datetime2", nullable: true)
|
||||||
|
},
|
||||||
|
constraints: table =>
|
||||||
|
{
|
||||||
|
table.PrimaryKey("PK_Orders", x => x.Id);
|
||||||
|
table.ForeignKey(
|
||||||
|
name: "FK_Orders_Clients_ClientId",
|
||||||
|
column: x => x.ClientId,
|
||||||
|
principalTable: "Clients",
|
||||||
|
principalColumn: "Id",
|
||||||
|
onDelete: ReferentialAction.Cascade);
|
||||||
|
table.ForeignKey(
|
||||||
|
name: "FK_Orders_Sushis_SushiId",
|
||||||
|
column: x => x.SushiId,
|
||||||
|
principalTable: "Sushis",
|
||||||
|
principalColumn: "Id",
|
||||||
|
onDelete: ReferentialAction.Cascade);
|
||||||
|
});
|
||||||
|
|
||||||
|
migrationBuilder.CreateTable(
|
||||||
|
name: "ShopSushis",
|
||||||
|
columns: table => new
|
||||||
|
{
|
||||||
|
Id = table.Column<int>(type: "int", nullable: false)
|
||||||
|
.Annotation("SqlServer:Identity", "1, 1"),
|
||||||
|
SushiId = table.Column<int>(type: "int", nullable: false),
|
||||||
|
ShopId = table.Column<int>(type: "int", nullable: false),
|
||||||
|
Count = table.Column<int>(type: "int", nullable: false)
|
||||||
|
},
|
||||||
|
constraints: table =>
|
||||||
|
{
|
||||||
|
table.PrimaryKey("PK_ShopSushis", x => x.Id);
|
||||||
|
table.ForeignKey(
|
||||||
|
name: "FK_ShopSushis_Shops_ShopId",
|
||||||
|
column: x => x.ShopId,
|
||||||
|
principalTable: "Shops",
|
||||||
|
principalColumn: "Id",
|
||||||
|
onDelete: ReferentialAction.Cascade);
|
||||||
|
table.ForeignKey(
|
||||||
|
name: "FK_ShopSushis_Sushis_SushiId",
|
||||||
|
column: x => x.SushiId,
|
||||||
|
principalTable: "Sushis",
|
||||||
|
principalColumn: "Id",
|
||||||
|
onDelete: ReferentialAction.Cascade);
|
||||||
|
});
|
||||||
|
|
||||||
|
migrationBuilder.CreateTable(
|
||||||
|
name: "SushiComponents",
|
||||||
|
columns: table => new
|
||||||
|
{
|
||||||
|
Id = table.Column<int>(type: "int", nullable: false)
|
||||||
|
.Annotation("SqlServer:Identity", "1, 1"),
|
||||||
|
SushiId = table.Column<int>(type: "int", nullable: false),
|
||||||
|
ComponentId = table.Column<int>(type: "int", nullable: false),
|
||||||
|
Count = table.Column<int>(type: "int", nullable: false)
|
||||||
|
},
|
||||||
|
constraints: table =>
|
||||||
|
{
|
||||||
|
table.PrimaryKey("PK_SushiComponents", x => x.Id);
|
||||||
|
table.ForeignKey(
|
||||||
|
name: "FK_SushiComponents_Components_ComponentId",
|
||||||
|
column: x => x.ComponentId,
|
||||||
|
principalTable: "Components",
|
||||||
|
principalColumn: "Id",
|
||||||
|
onDelete: ReferentialAction.Cascade);
|
||||||
|
table.ForeignKey(
|
||||||
|
name: "FK_SushiComponents_Sushis_SushiId",
|
||||||
|
column: x => x.SushiId,
|
||||||
|
principalTable: "Sushis",
|
||||||
|
principalColumn: "Id",
|
||||||
|
onDelete: ReferentialAction.Cascade);
|
||||||
|
});
|
||||||
|
|
||||||
|
migrationBuilder.CreateIndex(
|
||||||
|
name: "IX_Orders_ClientId",
|
||||||
|
table: "Orders",
|
||||||
|
column: "ClientId");
|
||||||
|
|
||||||
|
migrationBuilder.CreateIndex(
|
||||||
|
name: "IX_Orders_SushiId",
|
||||||
|
table: "Orders",
|
||||||
|
column: "SushiId");
|
||||||
|
|
||||||
|
migrationBuilder.CreateIndex(
|
||||||
|
name: "IX_ShopSushis_ShopId",
|
||||||
|
table: "ShopSushis",
|
||||||
|
column: "ShopId");
|
||||||
|
|
||||||
|
migrationBuilder.CreateIndex(
|
||||||
|
name: "IX_ShopSushis_SushiId",
|
||||||
|
table: "ShopSushis",
|
||||||
|
column: "SushiId");
|
||||||
|
|
||||||
|
migrationBuilder.CreateIndex(
|
||||||
|
name: "IX_SushiComponents_ComponentId",
|
||||||
|
table: "SushiComponents",
|
||||||
|
column: "ComponentId");
|
||||||
|
|
||||||
|
migrationBuilder.CreateIndex(
|
||||||
|
name: "IX_SushiComponents_SushiId",
|
||||||
|
table: "SushiComponents",
|
||||||
|
column: "SushiId");
|
||||||
|
}
|
||||||
|
|
||||||
|
/// <inheritdoc />
|
||||||
|
protected override void Down(MigrationBuilder migrationBuilder)
|
||||||
|
{
|
||||||
|
migrationBuilder.DropTable(
|
||||||
|
name: "Orders");
|
||||||
|
|
||||||
|
migrationBuilder.DropTable(
|
||||||
|
name: "ShopSushis");
|
||||||
|
|
||||||
|
migrationBuilder.DropTable(
|
||||||
|
name: "SushiComponents");
|
||||||
|
|
||||||
|
migrationBuilder.DropTable(
|
||||||
|
name: "Clients");
|
||||||
|
|
||||||
|
migrationBuilder.DropTable(
|
||||||
|
name: "Shops");
|
||||||
|
|
||||||
|
migrationBuilder.DropTable(
|
||||||
|
name: "Components");
|
||||||
|
|
||||||
|
migrationBuilder.DropTable(
|
||||||
|
name: "Sushis");
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
375
SushiBar/SushiBarDatabaseImplement/Migrations/20240617141624_InitCreate.Designer.cs
generated
Normal file
375
SushiBar/SushiBarDatabaseImplement/Migrations/20240617141624_InitCreate.Designer.cs
generated
Normal file
@ -0,0 +1,375 @@
|
|||||||
|
// <auto-generated />
|
||||||
|
using System;
|
||||||
|
using Microsoft.EntityFrameworkCore;
|
||||||
|
using Microsoft.EntityFrameworkCore.Infrastructure;
|
||||||
|
using Microsoft.EntityFrameworkCore.Metadata;
|
||||||
|
using Microsoft.EntityFrameworkCore.Migrations;
|
||||||
|
using Microsoft.EntityFrameworkCore.Storage.ValueConversion;
|
||||||
|
using SushiBarDatabaseImplement;
|
||||||
|
|
||||||
|
#nullable disable
|
||||||
|
|
||||||
|
namespace SushiBarDatabaseImplement.Migrations
|
||||||
|
{
|
||||||
|
[DbContext(typeof(SushiBarDatabase))]
|
||||||
|
[Migration("20240617141624_InitCreate")]
|
||||||
|
partial class InitCreate
|
||||||
|
{
|
||||||
|
/// <inheritdoc />
|
||||||
|
protected override void BuildTargetModel(ModelBuilder modelBuilder)
|
||||||
|
{
|
||||||
|
#pragma warning disable 612, 618
|
||||||
|
modelBuilder
|
||||||
|
.HasAnnotation("ProductVersion", "7.0.17")
|
||||||
|
.HasAnnotation("Relational:MaxIdentifierLength", 128);
|
||||||
|
|
||||||
|
SqlServerModelBuilderExtensions.UseIdentityColumns(modelBuilder);
|
||||||
|
|
||||||
|
modelBuilder.Entity("SushiBarDataModels.Models.Implementer", b =>
|
||||||
|
{
|
||||||
|
b.Property<int>("Id")
|
||||||
|
.ValueGeneratedOnAdd()
|
||||||
|
.HasColumnType("int");
|
||||||
|
|
||||||
|
SqlServerPropertyBuilderExtensions.UseIdentityColumn(b.Property<int>("Id"));
|
||||||
|
|
||||||
|
b.Property<string>("ImplementerFIO")
|
||||||
|
.IsRequired()
|
||||||
|
.HasColumnType("nvarchar(max)");
|
||||||
|
|
||||||
|
b.Property<string>("Password")
|
||||||
|
.IsRequired()
|
||||||
|
.HasColumnType("nvarchar(max)");
|
||||||
|
|
||||||
|
b.Property<int>("Qualification")
|
||||||
|
.HasColumnType("int");
|
||||||
|
|
||||||
|
b.Property<int>("WorkExperience")
|
||||||
|
.HasColumnType("int");
|
||||||
|
|
||||||
|
b.HasKey("Id");
|
||||||
|
|
||||||
|
b.ToTable("Implementers");
|
||||||
|
});
|
||||||
|
|
||||||
|
modelBuilder.Entity("SushiBarDatabaseImplement.Models.Client", b =>
|
||||||
|
{
|
||||||
|
b.Property<int>("Id")
|
||||||
|
.ValueGeneratedOnAdd()
|
||||||
|
.HasColumnType("int");
|
||||||
|
|
||||||
|
SqlServerPropertyBuilderExtensions.UseIdentityColumn(b.Property<int>("Id"));
|
||||||
|
|
||||||
|
b.Property<string>("ClientFIO")
|
||||||
|
.IsRequired()
|
||||||
|
.HasColumnType("nvarchar(max)");
|
||||||
|
|
||||||
|
b.Property<string>("Email")
|
||||||
|
.IsRequired()
|
||||||
|
.HasColumnType("nvarchar(max)");
|
||||||
|
|
||||||
|
b.Property<string>("Password")
|
||||||
|
.IsRequired()
|
||||||
|
.HasColumnType("nvarchar(max)");
|
||||||
|
|
||||||
|
b.HasKey("Id");
|
||||||
|
|
||||||
|
b.ToTable("Clients");
|
||||||
|
});
|
||||||
|
|
||||||
|
modelBuilder.Entity("SushiBarDatabaseImplement.Models.Component", b =>
|
||||||
|
{
|
||||||
|
b.Property<int>("Id")
|
||||||
|
.ValueGeneratedOnAdd()
|
||||||
|
.HasColumnType("int");
|
||||||
|
|
||||||
|
SqlServerPropertyBuilderExtensions.UseIdentityColumn(b.Property<int>("Id"));
|
||||||
|
|
||||||
|
b.Property<string>("ComponentName")
|
||||||
|
.IsRequired()
|
||||||
|
.HasColumnType("nvarchar(max)");
|
||||||
|
|
||||||
|
b.Property<double>("Cost")
|
||||||
|
.HasColumnType("float");
|
||||||
|
|
||||||
|
b.HasKey("Id");
|
||||||
|
|
||||||
|
b.ToTable("Components");
|
||||||
|
});
|
||||||
|
|
||||||
|
modelBuilder.Entity("SushiBarDatabaseImplement.Models.MessageInfo", b =>
|
||||||
|
{
|
||||||
|
b.Property<string>("MessageId")
|
||||||
|
.HasColumnType("nvarchar(450)");
|
||||||
|
|
||||||
|
b.Property<string>("Body")
|
||||||
|
.IsRequired()
|
||||||
|
.HasColumnType("nvarchar(max)");
|
||||||
|
|
||||||
|
b.Property<int?>("ClientId")
|
||||||
|
.HasColumnType("int");
|
||||||
|
|
||||||
|
b.Property<DateTime>("DateDelivery")
|
||||||
|
.HasColumnType("datetime2");
|
||||||
|
|
||||||
|
b.Property<string>("SenderName")
|
||||||
|
.IsRequired()
|
||||||
|
.HasColumnType("nvarchar(max)");
|
||||||
|
|
||||||
|
b.Property<string>("Subject")
|
||||||
|
.IsRequired()
|
||||||
|
.HasColumnType("nvarchar(max)");
|
||||||
|
|
||||||
|
b.HasKey("MessageId");
|
||||||
|
|
||||||
|
b.HasIndex("ClientId");
|
||||||
|
|
||||||
|
b.ToTable("MessageInfos");
|
||||||
|
});
|
||||||
|
|
||||||
|
modelBuilder.Entity("SushiBarDatabaseImplement.Models.Order", b =>
|
||||||
|
{
|
||||||
|
b.Property<int>("Id")
|
||||||
|
.ValueGeneratedOnAdd()
|
||||||
|
.HasColumnType("int");
|
||||||
|
|
||||||
|
SqlServerPropertyBuilderExtensions.UseIdentityColumn(b.Property<int>("Id"));
|
||||||
|
|
||||||
|
b.Property<int>("ClientId")
|
||||||
|
.HasColumnType("int");
|
||||||
|
|
||||||
|
b.Property<int>("Count")
|
||||||
|
.HasColumnType("int");
|
||||||
|
|
||||||
|
b.Property<DateTime>("DateCreate")
|
||||||
|
.HasColumnType("datetime2");
|
||||||
|
|
||||||
|
b.Property<DateTime?>("DateImplement")
|
||||||
|
.HasColumnType("datetime2");
|
||||||
|
|
||||||
|
b.Property<int?>("ImplementerId")
|
||||||
|
.HasColumnType("int");
|
||||||
|
|
||||||
|
b.Property<int>("Status")
|
||||||
|
.HasColumnType("int");
|
||||||
|
|
||||||
|
b.Property<double>("Sum")
|
||||||
|
.HasColumnType("float");
|
||||||
|
|
||||||
|
b.Property<int>("SushiId")
|
||||||
|
.HasColumnType("int");
|
||||||
|
|
||||||
|
b.HasKey("Id");
|
||||||
|
|
||||||
|
b.HasIndex("ClientId");
|
||||||
|
|
||||||
|
b.HasIndex("ImplementerId");
|
||||||
|
|
||||||
|
b.HasIndex("SushiId");
|
||||||
|
|
||||||
|
b.ToTable("Orders");
|
||||||
|
});
|
||||||
|
|
||||||
|
modelBuilder.Entity("SushiBarDatabaseImplement.Models.Shop", b =>
|
||||||
|
{
|
||||||
|
b.Property<int>("Id")
|
||||||
|
.ValueGeneratedOnAdd()
|
||||||
|
.HasColumnType("int");
|
||||||
|
|
||||||
|
SqlServerPropertyBuilderExtensions.UseIdentityColumn(b.Property<int>("Id"));
|
||||||
|
|
||||||
|
b.Property<string>("Adress")
|
||||||
|
.IsRequired()
|
||||||
|
.HasColumnType("nvarchar(max)");
|
||||||
|
|
||||||
|
b.Property<DateTime>("OpeningDate")
|
||||||
|
.HasColumnType("datetime2");
|
||||||
|
|
||||||
|
b.Property<string>("ShopName")
|
||||||
|
.IsRequired()
|
||||||
|
.HasColumnType("nvarchar(max)");
|
||||||
|
|
||||||
|
b.Property<int>("SushiMaxCount")
|
||||||
|
.HasColumnType("int");
|
||||||
|
|
||||||
|
b.HasKey("Id");
|
||||||
|
|
||||||
|
b.ToTable("Shops");
|
||||||
|
});
|
||||||
|
|
||||||
|
modelBuilder.Entity("SushiBarDatabaseImplement.Models.ShopSushis", b =>
|
||||||
|
{
|
||||||
|
b.Property<int>("Id")
|
||||||
|
.ValueGeneratedOnAdd()
|
||||||
|
.HasColumnType("int");
|
||||||
|
|
||||||
|
SqlServerPropertyBuilderExtensions.UseIdentityColumn(b.Property<int>("Id"));
|
||||||
|
|
||||||
|
b.Property<int>("Count")
|
||||||
|
.HasColumnType("int");
|
||||||
|
|
||||||
|
b.Property<int>("ShopId")
|
||||||
|
.HasColumnType("int");
|
||||||
|
|
||||||
|
b.Property<int>("SushiId")
|
||||||
|
.HasColumnType("int");
|
||||||
|
|
||||||
|
b.HasKey("Id");
|
||||||
|
|
||||||
|
b.HasIndex("ShopId");
|
||||||
|
|
||||||
|
b.HasIndex("SushiId");
|
||||||
|
|
||||||
|
b.ToTable("ShopSushis");
|
||||||
|
});
|
||||||
|
|
||||||
|
modelBuilder.Entity("SushiBarDatabaseImplement.Models.Sushi", b =>
|
||||||
|
{
|
||||||
|
b.Property<int>("Id")
|
||||||
|
.ValueGeneratedOnAdd()
|
||||||
|
.HasColumnType("int");
|
||||||
|
|
||||||
|
SqlServerPropertyBuilderExtensions.UseIdentityColumn(b.Property<int>("Id"));
|
||||||
|
|
||||||
|
b.Property<double>("Price")
|
||||||
|
.HasColumnType("float");
|
||||||
|
|
||||||
|
b.Property<string>("SushiName")
|
||||||
|
.IsRequired()
|
||||||
|
.HasColumnType("nvarchar(max)");
|
||||||
|
|
||||||
|
b.HasKey("Id");
|
||||||
|
|
||||||
|
b.ToTable("Sushis");
|
||||||
|
});
|
||||||
|
|
||||||
|
modelBuilder.Entity("SushiBarDatabaseImplement.Models.SushiComponent", b =>
|
||||||
|
{
|
||||||
|
b.Property<int>("Id")
|
||||||
|
.ValueGeneratedOnAdd()
|
||||||
|
.HasColumnType("int");
|
||||||
|
|
||||||
|
SqlServerPropertyBuilderExtensions.UseIdentityColumn(b.Property<int>("Id"));
|
||||||
|
|
||||||
|
b.Property<int>("ComponentId")
|
||||||
|
.HasColumnType("int");
|
||||||
|
|
||||||
|
b.Property<int>("Count")
|
||||||
|
.HasColumnType("int");
|
||||||
|
|
||||||
|
b.Property<int>("SushiId")
|
||||||
|
.HasColumnType("int");
|
||||||
|
|
||||||
|
b.HasKey("Id");
|
||||||
|
|
||||||
|
b.HasIndex("ComponentId");
|
||||||
|
|
||||||
|
b.HasIndex("SushiId");
|
||||||
|
|
||||||
|
b.ToTable("SushiComponents");
|
||||||
|
});
|
||||||
|
|
||||||
|
modelBuilder.Entity("SushiBarDatabaseImplement.Models.MessageInfo", b =>
|
||||||
|
{
|
||||||
|
b.HasOne("SushiBarDatabaseImplement.Models.Client", "Client")
|
||||||
|
.WithMany("ClientMessages")
|
||||||
|
.HasForeignKey("ClientId");
|
||||||
|
|
||||||
|
b.Navigation("Client");
|
||||||
|
});
|
||||||
|
|
||||||
|
modelBuilder.Entity("SushiBarDatabaseImplement.Models.Order", b =>
|
||||||
|
{
|
||||||
|
b.HasOne("SushiBarDatabaseImplement.Models.Client", "Client")
|
||||||
|
.WithMany("ClientOrders")
|
||||||
|
.HasForeignKey("ClientId")
|
||||||
|
.OnDelete(DeleteBehavior.Cascade)
|
||||||
|
.IsRequired();
|
||||||
|
|
||||||
|
b.HasOne("SushiBarDataModels.Models.Implementer", "Implementer")
|
||||||
|
.WithMany("Order")
|
||||||
|
.HasForeignKey("ImplementerId");
|
||||||
|
|
||||||
|
b.HasOne("SushiBarDatabaseImplement.Models.Sushi", "Sushi")
|
||||||
|
.WithMany("Orders")
|
||||||
|
.HasForeignKey("SushiId")
|
||||||
|
.OnDelete(DeleteBehavior.Cascade)
|
||||||
|
.IsRequired();
|
||||||
|
|
||||||
|
b.Navigation("Client");
|
||||||
|
|
||||||
|
b.Navigation("Implementer");
|
||||||
|
|
||||||
|
b.Navigation("Sushi");
|
||||||
|
});
|
||||||
|
|
||||||
|
modelBuilder.Entity("SushiBarDatabaseImplement.Models.ShopSushis", b =>
|
||||||
|
{
|
||||||
|
b.HasOne("SushiBarDatabaseImplement.Models.Shop", "Shop")
|
||||||
|
.WithMany("Sushis")
|
||||||
|
.HasForeignKey("ShopId")
|
||||||
|
.OnDelete(DeleteBehavior.Cascade)
|
||||||
|
.IsRequired();
|
||||||
|
|
||||||
|
b.HasOne("SushiBarDatabaseImplement.Models.Sushi", "Sushi")
|
||||||
|
.WithMany()
|
||||||
|
.HasForeignKey("SushiId")
|
||||||
|
.OnDelete(DeleteBehavior.Cascade)
|
||||||
|
.IsRequired();
|
||||||
|
|
||||||
|
b.Navigation("Shop");
|
||||||
|
|
||||||
|
b.Navigation("Sushi");
|
||||||
|
});
|
||||||
|
|
||||||
|
modelBuilder.Entity("SushiBarDatabaseImplement.Models.SushiComponent", b =>
|
||||||
|
{
|
||||||
|
b.HasOne("SushiBarDatabaseImplement.Models.Component", "Component")
|
||||||
|
.WithMany("SushiComponents")
|
||||||
|
.HasForeignKey("ComponentId")
|
||||||
|
.OnDelete(DeleteBehavior.Cascade)
|
||||||
|
.IsRequired();
|
||||||
|
|
||||||
|
b.HasOne("SushiBarDatabaseImplement.Models.Sushi", "Sushi")
|
||||||
|
.WithMany("Components")
|
||||||
|
.HasForeignKey("SushiId")
|
||||||
|
.OnDelete(DeleteBehavior.Cascade)
|
||||||
|
.IsRequired();
|
||||||
|
|
||||||
|
b.Navigation("Component");
|
||||||
|
|
||||||
|
b.Navigation("Sushi");
|
||||||
|
});
|
||||||
|
|
||||||
|
modelBuilder.Entity("SushiBarDataModels.Models.Implementer", b =>
|
||||||
|
{
|
||||||
|
b.Navigation("Order");
|
||||||
|
});
|
||||||
|
|
||||||
|
modelBuilder.Entity("SushiBarDatabaseImplement.Models.Client", b =>
|
||||||
|
{
|
||||||
|
b.Navigation("ClientMessages");
|
||||||
|
|
||||||
|
b.Navigation("ClientOrders");
|
||||||
|
});
|
||||||
|
|
||||||
|
modelBuilder.Entity("SushiBarDatabaseImplement.Models.Component", b =>
|
||||||
|
{
|
||||||
|
b.Navigation("SushiComponents");
|
||||||
|
});
|
||||||
|
|
||||||
|
modelBuilder.Entity("SushiBarDatabaseImplement.Models.Shop", b =>
|
||||||
|
{
|
||||||
|
b.Navigation("Sushis");
|
||||||
|
});
|
||||||
|
|
||||||
|
modelBuilder.Entity("SushiBarDatabaseImplement.Models.Sushi", b =>
|
||||||
|
{
|
||||||
|
b.Navigation("Components");
|
||||||
|
|
||||||
|
b.Navigation("Orders");
|
||||||
|
});
|
||||||
|
#pragma warning restore 612, 618
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
@ -0,0 +1,273 @@
|
|||||||
|
using System;
|
||||||
|
using Microsoft.EntityFrameworkCore.Migrations;
|
||||||
|
|
||||||
|
#nullable disable
|
||||||
|
|
||||||
|
namespace SushiBarDatabaseImplement.Migrations
|
||||||
|
{
|
||||||
|
/// <inheritdoc />
|
||||||
|
public partial class InitCreate : Migration
|
||||||
|
{
|
||||||
|
/// <inheritdoc />
|
||||||
|
protected override void Up(MigrationBuilder migrationBuilder)
|
||||||
|
{
|
||||||
|
migrationBuilder.CreateTable(
|
||||||
|
name: "Clients",
|
||||||
|
columns: table => new
|
||||||
|
{
|
||||||
|
Id = table.Column<int>(type: "int", nullable: false)
|
||||||
|
.Annotation("SqlServer:Identity", "1, 1"),
|
||||||
|
ClientFIO = table.Column<string>(type: "nvarchar(max)", nullable: false),
|
||||||
|
Email = table.Column<string>(type: "nvarchar(max)", nullable: false),
|
||||||
|
Password = table.Column<string>(type: "nvarchar(max)", nullable: false)
|
||||||
|
},
|
||||||
|
constraints: table =>
|
||||||
|
{
|
||||||
|
table.PrimaryKey("PK_Clients", x => x.Id);
|
||||||
|
});
|
||||||
|
|
||||||
|
migrationBuilder.CreateTable(
|
||||||
|
name: "Components",
|
||||||
|
columns: table => new
|
||||||
|
{
|
||||||
|
Id = table.Column<int>(type: "int", nullable: false)
|
||||||
|
.Annotation("SqlServer:Identity", "1, 1"),
|
||||||
|
ComponentName = table.Column<string>(type: "nvarchar(max)", nullable: false),
|
||||||
|
Cost = table.Column<double>(type: "float", nullable: false)
|
||||||
|
},
|
||||||
|
constraints: table =>
|
||||||
|
{
|
||||||
|
table.PrimaryKey("PK_Components", x => x.Id);
|
||||||
|
});
|
||||||
|
|
||||||
|
migrationBuilder.CreateTable(
|
||||||
|
name: "Implementers",
|
||||||
|
columns: table => new
|
||||||
|
{
|
||||||
|
Id = table.Column<int>(type: "int", nullable: false)
|
||||||
|
.Annotation("SqlServer:Identity", "1, 1"),
|
||||||
|
ImplementerFIO = table.Column<string>(type: "nvarchar(max)", nullable: false),
|
||||||
|
Password = table.Column<string>(type: "nvarchar(max)", nullable: false),
|
||||||
|
WorkExperience = table.Column<int>(type: "int", nullable: false),
|
||||||
|
Qualification = table.Column<int>(type: "int", nullable: false)
|
||||||
|
},
|
||||||
|
constraints: table =>
|
||||||
|
{
|
||||||
|
table.PrimaryKey("PK_Implementers", x => x.Id);
|
||||||
|
});
|
||||||
|
|
||||||
|
migrationBuilder.CreateTable(
|
||||||
|
name: "Shops",
|
||||||
|
columns: table => new
|
||||||
|
{
|
||||||
|
Id = table.Column<int>(type: "int", nullable: false)
|
||||||
|
.Annotation("SqlServer:Identity", "1, 1"),
|
||||||
|
ShopName = table.Column<string>(type: "nvarchar(max)", nullable: false),
|
||||||
|
Adress = table.Column<string>(type: "nvarchar(max)", nullable: false),
|
||||||
|
OpeningDate = table.Column<DateTime>(type: "datetime2", nullable: false),
|
||||||
|
SushiMaxCount = table.Column<int>(type: "int", nullable: false)
|
||||||
|
},
|
||||||
|
constraints: table =>
|
||||||
|
{
|
||||||
|
table.PrimaryKey("PK_Shops", x => x.Id);
|
||||||
|
});
|
||||||
|
|
||||||
|
migrationBuilder.CreateTable(
|
||||||
|
name: "Sushis",
|
||||||
|
columns: table => new
|
||||||
|
{
|
||||||
|
Id = table.Column<int>(type: "int", nullable: false)
|
||||||
|
.Annotation("SqlServer:Identity", "1, 1"),
|
||||||
|
SushiName = table.Column<string>(type: "nvarchar(max)", nullable: false),
|
||||||
|
Price = table.Column<double>(type: "float", nullable: false)
|
||||||
|
},
|
||||||
|
constraints: table =>
|
||||||
|
{
|
||||||
|
table.PrimaryKey("PK_Sushis", x => x.Id);
|
||||||
|
});
|
||||||
|
|
||||||
|
migrationBuilder.CreateTable(
|
||||||
|
name: "MessageInfos",
|
||||||
|
columns: table => new
|
||||||
|
{
|
||||||
|
MessageId = table.Column<string>(type: "nvarchar(450)", nullable: false),
|
||||||
|
ClientId = table.Column<int>(type: "int", nullable: true),
|
||||||
|
SenderName = table.Column<string>(type: "nvarchar(max)", nullable: false),
|
||||||
|
DateDelivery = table.Column<DateTime>(type: "datetime2", nullable: false),
|
||||||
|
Subject = table.Column<string>(type: "nvarchar(max)", nullable: false),
|
||||||
|
Body = table.Column<string>(type: "nvarchar(max)", nullable: false)
|
||||||
|
},
|
||||||
|
constraints: table =>
|
||||||
|
{
|
||||||
|
table.PrimaryKey("PK_MessageInfos", x => x.MessageId);
|
||||||
|
table.ForeignKey(
|
||||||
|
name: "FK_MessageInfos_Clients_ClientId",
|
||||||
|
column: x => x.ClientId,
|
||||||
|
principalTable: "Clients",
|
||||||
|
principalColumn: "Id");
|
||||||
|
});
|
||||||
|
|
||||||
|
migrationBuilder.CreateTable(
|
||||||
|
name: "Orders",
|
||||||
|
columns: table => new
|
||||||
|
{
|
||||||
|
Id = table.Column<int>(type: "int", nullable: false)
|
||||||
|
.Annotation("SqlServer:Identity", "1, 1"),
|
||||||
|
ClientId = table.Column<int>(type: "int", nullable: false),
|
||||||
|
SushiId = table.Column<int>(type: "int", nullable: false),
|
||||||
|
Count = table.Column<int>(type: "int", nullable: false),
|
||||||
|
Sum = table.Column<double>(type: "float", nullable: false),
|
||||||
|
Status = table.Column<int>(type: "int", nullable: false),
|
||||||
|
DateCreate = table.Column<DateTime>(type: "datetime2", nullable: false),
|
||||||
|
DateImplement = table.Column<DateTime>(type: "datetime2", nullable: true),
|
||||||
|
ImplementerId = table.Column<int>(type: "int", nullable: true)
|
||||||
|
},
|
||||||
|
constraints: table =>
|
||||||
|
{
|
||||||
|
table.PrimaryKey("PK_Orders", x => x.Id);
|
||||||
|
table.ForeignKey(
|
||||||
|
name: "FK_Orders_Clients_ClientId",
|
||||||
|
column: x => x.ClientId,
|
||||||
|
principalTable: "Clients",
|
||||||
|
principalColumn: "Id",
|
||||||
|
onDelete: ReferentialAction.Cascade);
|
||||||
|
table.ForeignKey(
|
||||||
|
name: "FK_Orders_Implementers_ImplementerId",
|
||||||
|
column: x => x.ImplementerId,
|
||||||
|
principalTable: "Implementers",
|
||||||
|
principalColumn: "Id");
|
||||||
|
table.ForeignKey(
|
||||||
|
name: "FK_Orders_Sushis_SushiId",
|
||||||
|
column: x => x.SushiId,
|
||||||
|
principalTable: "Sushis",
|
||||||
|
principalColumn: "Id",
|
||||||
|
onDelete: ReferentialAction.Cascade);
|
||||||
|
});
|
||||||
|
|
||||||
|
migrationBuilder.CreateTable(
|
||||||
|
name: "ShopSushis",
|
||||||
|
columns: table => new
|
||||||
|
{
|
||||||
|
Id = table.Column<int>(type: "int", nullable: false)
|
||||||
|
.Annotation("SqlServer:Identity", "1, 1"),
|
||||||
|
SushiId = table.Column<int>(type: "int", nullable: false),
|
||||||
|
ShopId = table.Column<int>(type: "int", nullable: false),
|
||||||
|
Count = table.Column<int>(type: "int", nullable: false)
|
||||||
|
},
|
||||||
|
constraints: table =>
|
||||||
|
{
|
||||||
|
table.PrimaryKey("PK_ShopSushis", x => x.Id);
|
||||||
|
table.ForeignKey(
|
||||||
|
name: "FK_ShopSushis_Shops_ShopId",
|
||||||
|
column: x => x.ShopId,
|
||||||
|
principalTable: "Shops",
|
||||||
|
principalColumn: "Id",
|
||||||
|
onDelete: ReferentialAction.Cascade);
|
||||||
|
table.ForeignKey(
|
||||||
|
name: "FK_ShopSushis_Sushis_SushiId",
|
||||||
|
column: x => x.SushiId,
|
||||||
|
principalTable: "Sushis",
|
||||||
|
principalColumn: "Id",
|
||||||
|
onDelete: ReferentialAction.Cascade);
|
||||||
|
});
|
||||||
|
|
||||||
|
migrationBuilder.CreateTable(
|
||||||
|
name: "SushiComponents",
|
||||||
|
columns: table => new
|
||||||
|
{
|
||||||
|
Id = table.Column<int>(type: "int", nullable: false)
|
||||||
|
.Annotation("SqlServer:Identity", "1, 1"),
|
||||||
|
SushiId = table.Column<int>(type: "int", nullable: false),
|
||||||
|
ComponentId = table.Column<int>(type: "int", nullable: false),
|
||||||
|
Count = table.Column<int>(type: "int", nullable: false)
|
||||||
|
},
|
||||||
|
constraints: table =>
|
||||||
|
{
|
||||||
|
table.PrimaryKey("PK_SushiComponents", x => x.Id);
|
||||||
|
table.ForeignKey(
|
||||||
|
name: "FK_SushiComponents_Components_ComponentId",
|
||||||
|
column: x => x.ComponentId,
|
||||||
|
principalTable: "Components",
|
||||||
|
principalColumn: "Id",
|
||||||
|
onDelete: ReferentialAction.Cascade);
|
||||||
|
table.ForeignKey(
|
||||||
|
name: "FK_SushiComponents_Sushis_SushiId",
|
||||||
|
column: x => x.SushiId,
|
||||||
|
principalTable: "Sushis",
|
||||||
|
principalColumn: "Id",
|
||||||
|
onDelete: ReferentialAction.Cascade);
|
||||||
|
});
|
||||||
|
|
||||||
|
migrationBuilder.CreateIndex(
|
||||||
|
name: "IX_MessageInfos_ClientId",
|
||||||
|
table: "MessageInfos",
|
||||||
|
column: "ClientId");
|
||||||
|
|
||||||
|
migrationBuilder.CreateIndex(
|
||||||
|
name: "IX_Orders_ClientId",
|
||||||
|
table: "Orders",
|
||||||
|
column: "ClientId");
|
||||||
|
|
||||||
|
migrationBuilder.CreateIndex(
|
||||||
|
name: "IX_Orders_ImplementerId",
|
||||||
|
table: "Orders",
|
||||||
|
column: "ImplementerId");
|
||||||
|
|
||||||
|
migrationBuilder.CreateIndex(
|
||||||
|
name: "IX_Orders_SushiId",
|
||||||
|
table: "Orders",
|
||||||
|
column: "SushiId");
|
||||||
|
|
||||||
|
migrationBuilder.CreateIndex(
|
||||||
|
name: "IX_ShopSushis_ShopId",
|
||||||
|
table: "ShopSushis",
|
||||||
|
column: "ShopId");
|
||||||
|
|
||||||
|
migrationBuilder.CreateIndex(
|
||||||
|
name: "IX_ShopSushis_SushiId",
|
||||||
|
table: "ShopSushis",
|
||||||
|
column: "SushiId");
|
||||||
|
|
||||||
|
migrationBuilder.CreateIndex(
|
||||||
|
name: "IX_SushiComponents_ComponentId",
|
||||||
|
table: "SushiComponents",
|
||||||
|
column: "ComponentId");
|
||||||
|
|
||||||
|
migrationBuilder.CreateIndex(
|
||||||
|
name: "IX_SushiComponents_SushiId",
|
||||||
|
table: "SushiComponents",
|
||||||
|
column: "SushiId");
|
||||||
|
}
|
||||||
|
|
||||||
|
/// <inheritdoc />
|
||||||
|
protected override void Down(MigrationBuilder migrationBuilder)
|
||||||
|
{
|
||||||
|
migrationBuilder.DropTable(
|
||||||
|
name: "MessageInfos");
|
||||||
|
|
||||||
|
migrationBuilder.DropTable(
|
||||||
|
name: "Orders");
|
||||||
|
|
||||||
|
migrationBuilder.DropTable(
|
||||||
|
name: "ShopSushis");
|
||||||
|
|
||||||
|
migrationBuilder.DropTable(
|
||||||
|
name: "SushiComponents");
|
||||||
|
|
||||||
|
migrationBuilder.DropTable(
|
||||||
|
name: "Clients");
|
||||||
|
|
||||||
|
migrationBuilder.DropTable(
|
||||||
|
name: "Implementers");
|
||||||
|
|
||||||
|
migrationBuilder.DropTable(
|
||||||
|
name: "Shops");
|
||||||
|
|
||||||
|
migrationBuilder.DropTable(
|
||||||
|
name: "Components");
|
||||||
|
|
||||||
|
migrationBuilder.DropTable(
|
||||||
|
name: "Sushis");
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
@ -23,5 +23,7 @@ namespace SushiBarDatabaseImplement
|
|||||||
public virtual DbSet<SushiComponent> SushiComponents { set; get; }
|
public virtual DbSet<SushiComponent> SushiComponents { set; get; }
|
||||||
public virtual DbSet<Order> Orders { set; get; }
|
public virtual DbSet<Order> Orders { set; get; }
|
||||||
public virtual DbSet<Client> Clients { set; get; }
|
public virtual DbSet<Client> Clients { set; get; }
|
||||||
|
public virtual DbSet<Shop> Shops { get; set; }
|
||||||
|
public virtual DbSet<ShopSushis> ShopSushis { get; set; }
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
@ -25,7 +25,6 @@ namespace SushiBarFileImplement.Implements
|
|||||||
public List<OrderViewModel> GetFilteredList(OrderSearchModel model)
|
public List<OrderViewModel> GetFilteredList(OrderSearchModel model)
|
||||||
{
|
{
|
||||||
if (model.DateFrom.HasValue)
|
if (model.DateFrom.HasValue)
|
||||||
if (!model.DateFrom.HasValue || !model.DateFrom.HasValue || !model.DateTo.HasValue)
|
|
||||||
{
|
{
|
||||||
return source.Orders.Where(x => x.DateCreate >= model.DateFrom && x.DateCreate <= model.DateTo)
|
return source.Orders.Where(x => x.DateCreate >= model.DateFrom && x.DateCreate <= model.DateTo)
|
||||||
.Select(x => GetViewModel(x)).ToList();
|
.Select(x => GetViewModel(x)).ToList();
|
||||||
|
@ -14,12 +14,14 @@ namespace SushiBarListImplement
|
|||||||
public List<Order> Orders { get; set; }
|
public List<Order> Orders { get; set; }
|
||||||
public List<Sushi> Sushis { get; set; }
|
public List<Sushi> Sushis { get; set; }
|
||||||
public List<Client> Clients { get; set; }
|
public List<Client> Clients { get; set; }
|
||||||
|
public List<Shop> Shops { get; set; }
|
||||||
private DataListSingleton()
|
private DataListSingleton()
|
||||||
{
|
{
|
||||||
Components = new List<Component>();
|
Components = new List<Component>();
|
||||||
Orders = new List<Order>();
|
Orders = new List<Order>();
|
||||||
Sushis = new List<Sushi>();
|
Sushis = new List<Sushi>();
|
||||||
Clients = new List<Client>();
|
Clients = new List<Client>();
|
||||||
|
Shops = new List<Shop>();
|
||||||
}
|
}
|
||||||
public static DataListSingleton GetInstance()
|
public static DataListSingleton GetInstance()
|
||||||
{
|
{
|
||||||
|
12
SushiBar/SushiBarRestApi/APIConfig.cs
Normal file
12
SushiBar/SushiBarRestApi/APIConfig.cs
Normal file
@ -0,0 +1,12 @@
|
|||||||
|
namespace SushiBarRestApi
|
||||||
|
{
|
||||||
|
public class APIConfig
|
||||||
|
{
|
||||||
|
public static string? ShopPassword;
|
||||||
|
|
||||||
|
public static void LoadData(IConfiguration configuration)
|
||||||
|
{
|
||||||
|
ShopPassword = configuration["ShopAPIPassword"];
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
156
SushiBar/SushiBarRestApi/Controllers/ShopController.cs
Normal file
156
SushiBar/SushiBarRestApi/Controllers/ShopController.cs
Normal file
@ -0,0 +1,156 @@
|
|||||||
|
using Microsoft.AspNetCore.Mvc;
|
||||||
|
using SushiBarContracts.BindingModels;
|
||||||
|
using SushiBarContracts.BusinessLogicsContracts;
|
||||||
|
using SushiBarContracts.SearchModels;
|
||||||
|
using SushiBarContracts.ViewModels;
|
||||||
|
|
||||||
|
namespace SushiBarRestApi.Controllers
|
||||||
|
{
|
||||||
|
[Route("api/[controller]/[action]")]
|
||||||
|
[ApiController]
|
||||||
|
public class ShopController : Controller
|
||||||
|
{
|
||||||
|
private readonly ILogger _logger;
|
||||||
|
private readonly IShopLogic _shopLogic;
|
||||||
|
|
||||||
|
public ShopController(ILogger<ShopController> logger, IShopLogic shopLogic)
|
||||||
|
{
|
||||||
|
_logger = logger;
|
||||||
|
_shopLogic = shopLogic;
|
||||||
|
}
|
||||||
|
|
||||||
|
[HttpGet]
|
||||||
|
public bool Authentication(string password)
|
||||||
|
{
|
||||||
|
return CheckPassword(password);
|
||||||
|
}
|
||||||
|
|
||||||
|
[HttpGet]
|
||||||
|
public List<ShopViewModel>? GetShopList(string password)
|
||||||
|
{
|
||||||
|
if (!CheckPassword(password))
|
||||||
|
{
|
||||||
|
return null;
|
||||||
|
}
|
||||||
|
try
|
||||||
|
{
|
||||||
|
return _shopLogic.ReadList(null);
|
||||||
|
}
|
||||||
|
catch (Exception ex)
|
||||||
|
{
|
||||||
|
_logger.LogError(ex, "Ошибка получения списка магазинов");
|
||||||
|
throw;
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
[HttpGet]
|
||||||
|
public ShopSushiViewModel? GetShop(int shopId, string password)
|
||||||
|
{
|
||||||
|
if (!CheckPassword(password))
|
||||||
|
{
|
||||||
|
return null;
|
||||||
|
}
|
||||||
|
try
|
||||||
|
{
|
||||||
|
var shop = _shopLogic.ReadElement(new ShopSearchModel { Id = shopId });
|
||||||
|
return new ShopSushiViewModel
|
||||||
|
{
|
||||||
|
Shop = shop,
|
||||||
|
ShopSushi = shop.ShopSushis.ToDictionary(x => x.Key, x => new SushiCount
|
||||||
|
{
|
||||||
|
Sushi = new SushiViewModel()
|
||||||
|
{
|
||||||
|
Id = x.Value.Item1.Id,
|
||||||
|
SushiName = x.Value.Item1.SushiName,
|
||||||
|
SushiComponents = x.Value.Item1.SushiComponents,
|
||||||
|
Price = x.Value.Item1.Price,
|
||||||
|
},
|
||||||
|
Count = x.Value.Item2
|
||||||
|
})
|
||||||
|
};
|
||||||
|
}
|
||||||
|
catch (Exception ex)
|
||||||
|
{
|
||||||
|
_logger.LogError(ex, "Ошибка получения магазина");
|
||||||
|
throw;
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
[HttpPost]
|
||||||
|
public void CreateShop(ShopBindingModel model, string password)
|
||||||
|
{
|
||||||
|
if (!CheckPassword(password))
|
||||||
|
{
|
||||||
|
return;
|
||||||
|
}
|
||||||
|
try
|
||||||
|
{
|
||||||
|
_shopLogic.Create(model);
|
||||||
|
}
|
||||||
|
catch (Exception ex)
|
||||||
|
{
|
||||||
|
_logger.LogError(ex, "Ошибка создания магазина");
|
||||||
|
throw;
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
[HttpPost]
|
||||||
|
public void UpdateShop(ShopBindingModel model, string password)
|
||||||
|
{
|
||||||
|
if (!CheckPassword(password))
|
||||||
|
{
|
||||||
|
return;
|
||||||
|
}
|
||||||
|
try
|
||||||
|
{
|
||||||
|
_shopLogic.Update(model);
|
||||||
|
}
|
||||||
|
catch (Exception ex)
|
||||||
|
{
|
||||||
|
_logger.LogError(ex, "Ошибка обновления магазина");
|
||||||
|
throw;
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
[HttpDelete]
|
||||||
|
public void DeleteShop(int shopId, string password)
|
||||||
|
{
|
||||||
|
if (!CheckPassword(password))
|
||||||
|
{
|
||||||
|
return;
|
||||||
|
}
|
||||||
|
try
|
||||||
|
{
|
||||||
|
_shopLogic.Delete(new ShopBindingModel { Id = shopId });
|
||||||
|
}
|
||||||
|
catch (Exception ex)
|
||||||
|
{
|
||||||
|
_logger.LogError(ex, "Ошибка удаления магазина");
|
||||||
|
throw;
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
[HttpPost]
|
||||||
|
public void MakeSypply(SupplyBindingModel model, string password)
|
||||||
|
{
|
||||||
|
if (!CheckPassword(password))
|
||||||
|
{
|
||||||
|
return;
|
||||||
|
}
|
||||||
|
try
|
||||||
|
{
|
||||||
|
_shopLogic.MakeSupply(model);
|
||||||
|
}
|
||||||
|
catch (Exception ex)
|
||||||
|
{
|
||||||
|
_logger.LogError(ex, "Ошибка создания поставки в магазин");
|
||||||
|
throw;
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
private bool CheckPassword(string password)
|
||||||
|
{
|
||||||
|
return APIConfig.ShopPassword == password;
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
@ -5,17 +5,20 @@ using SushiBarBusinessLogic.BusinessLogics;
|
|||||||
using SushiBarContracts.BusinessLogicsContracts;
|
using SushiBarContracts.BusinessLogicsContracts;
|
||||||
using SushiBarContracts.StoragesContracts;
|
using SushiBarContracts.StoragesContracts;
|
||||||
using SushiBarDatabaseImplement.Implements;
|
using SushiBarDatabaseImplement.Implements;
|
||||||
|
using SushiBarRestApi;
|
||||||
|
|
||||||
var builder = WebApplication.CreateBuilder(args);
|
var builder = WebApplication.CreateBuilder(args);
|
||||||
|
|
||||||
// Add services to the container.
|
// Add services to the container.
|
||||||
|
|
||||||
builder.Services.AddTransient<IClientStorage, ClientStorage>();
|
builder.Services.AddTransient<IClientStorage, ClientStorage>();
|
||||||
|
builder.Services.AddTransient<IShopStorage, ShopStorage>();
|
||||||
builder.Services.AddTransient<IOrderStorage, OrderStorage>();
|
builder.Services.AddTransient<IOrderStorage, OrderStorage>();
|
||||||
builder.Services.AddTransient<ISushiStorage, SushiStorage>();
|
builder.Services.AddTransient<ISushiStorage, SushiStorage>();
|
||||||
builder.Services.AddTransient<IOrderLogic, OrderLogic>();
|
builder.Services.AddTransient<IOrderLogic, OrderLogic>();
|
||||||
builder.Services.AddTransient<IClientLogic, ClientLogic>();
|
builder.Services.AddTransient<IClientLogic, ClientLogic>();
|
||||||
builder.Services.AddTransient<ISushiLogic, SushiLogic>();
|
builder.Services.AddTransient<ISushiLogic, SushiLogic>();
|
||||||
|
builder.Services.AddTransient<IShopLogic, ShopLogic>();
|
||||||
|
|
||||||
builder.Services.AddControllers();
|
builder.Services.AddControllers();
|
||||||
// Learn more about configuring Swagger/OpenAPI at https://aka.ms/aspnetcore/swashbuckle
|
// Learn more about configuring Swagger/OpenAPI at https://aka.ms/aspnetcore/swashbuckle
|
||||||
@ -30,6 +33,7 @@ builder.Services.AddSwaggerGen(c =>
|
|||||||
});
|
});
|
||||||
});
|
});
|
||||||
var app = builder.Build();
|
var app = builder.Build();
|
||||||
|
APIConfig.LoadData(builder.Configuration);
|
||||||
// Configure the HTTP request pipeline.
|
// Configure the HTTP request pipeline.
|
||||||
if (app.Environment.IsDevelopment())
|
if (app.Environment.IsDevelopment())
|
||||||
{
|
{
|
||||||
|
@ -5,5 +5,7 @@
|
|||||||
"Microsoft.AspNetCore": "Warning"
|
"Microsoft.AspNetCore": "Warning"
|
||||||
}
|
}
|
||||||
},
|
},
|
||||||
"AllowedHosts": "*"
|
"AllowedHosts": "*",
|
||||||
|
|
||||||
|
"ShopAPIPassword": "123456"
|
||||||
}
|
}
|
||||||
|
227
SushiBar/SushiBarView/FormMain.Designer.cs
generated
227
SushiBar/SushiBarView/FormMain.Designer.cs
generated
@ -39,7 +39,7 @@
|
|||||||
sushiToolStripMenuItemToolStripMenuItem = new ToolStripMenuItem();
|
sushiToolStripMenuItemToolStripMenuItem = new ToolStripMenuItem();
|
||||||
отчётыToolStripMenuItem = new ToolStripMenuItem();
|
отчётыToolStripMenuItem = new ToolStripMenuItem();
|
||||||
componentsToolStripMenuItem1 = new ToolStripMenuItem();
|
componentsToolStripMenuItem1 = new ToolStripMenuItem();
|
||||||
componentSushiToolStripMenuItem1 = new ToolStripMenuItem();
|
//componentSushiToolStripMenuItem1 = new ToolStripMenuItem();
|
||||||
ordersToolStripMenuItem = new ToolStripMenuItem();
|
ordersToolStripMenuItem = new ToolStripMenuItem();
|
||||||
dataGridView = new DataGridView();
|
dataGridView = new DataGridView();
|
||||||
ClientToolStripMenuItem = new ToolStripMenuItem();
|
ClientToolStripMenuItem = new ToolStripMenuItem();
|
||||||
@ -126,77 +126,194 @@
|
|||||||
//
|
//
|
||||||
// menuStrip
|
// menuStrip
|
||||||
//
|
//
|
||||||
this.menuStrip.Items.AddRange(new System.Windows.Forms.ToolStripItem[] {
|
menuStrip.Items.AddRange(new ToolStripItem[] { toolStripMenuItem1, отчётыToolStripMenuItem });
|
||||||
this.toolStripMenuItem1, this.отчётыToolStripMenuItem});
|
menuStrip.Location = new Point(0, 0);
|
||||||
this.menuStrip.Location = new System.Drawing.Point(0, 0);
|
menuStrip.Name = "menuStrip";
|
||||||
this.menuStrip.Name = "menuStrip";
|
menuStrip.Size = new Size(922, 24);
|
||||||
this.menuStrip.Size = new System.Drawing.Size(922, 24);
|
menuStrip.TabIndex = 5;
|
||||||
this.menuStrip.TabIndex = 5;
|
menuStrip.Text = "menuStrip1";
|
||||||
this.menuStrip.Text = "menuStrip1";
|
menuStrip.Items.AddRange(new ToolStripItem[] { toolStripMenuItem1, отчётыToolStripMenuItem, операцииToolStripMenuItem });
|
||||||
|
menuStrip.Location = new Point(0, 0);
|
||||||
|
menuStrip.Name = "menuStrip";
|
||||||
|
menuStrip.Size = new Size(922, 24);
|
||||||
|
menuStrip.TabIndex = 5;
|
||||||
|
menuStrip.Text = "menuStrip1";
|
||||||
//
|
//
|
||||||
// toolStripMenuItem1
|
// toolStripMenuItem1
|
||||||
//
|
//
|
||||||
this.toolStripMenuItem1.DropDownItems.AddRange(new System.Windows.Forms.ToolStripItem[] {
|
toolStripMenuItem1.DropDownItems.AddRange(new ToolStripItem[] { componentsToolStripMenuItemToolStripMenuItem, sushiToolStripMenuItemToolStripMenuItem, ClientToolStripMenuItem });
|
||||||
this.componentsToolStripMenuItemToolStripMenuItem,
|
toolStripMenuItem1.Name = "toolStripMenuItem1";
|
||||||
this.sushiToolStripMenuItemToolStripMenuItem});
|
toolStripMenuItem1.Size = new Size(94, 20);
|
||||||
this.toolStripMenuItem1.Name = "toolStripMenuItem1";
|
toolStripMenuItem1.Text = "Справочники";
|
||||||
this.toolStripMenuItem1.Size = new System.Drawing.Size(94, 20);
|
toolStripMenuItem1.DropDownItems.AddRange(new ToolStripItem[] { componentsToolStripMenuItemToolStripMenuItem, sushiToolStripMenuItemToolStripMenuItem, магазиныToolStripMenuItem });
|
||||||
this.toolStripMenuItem1.Text = "Справочники";
|
toolStripMenuItem1.Name = "toolStripMenuItem1";
|
||||||
|
toolStripMenuItem1.Size = new Size(94, 20);
|
||||||
|
toolStripMenuItem1.Text = "Справочники";
|
||||||
//
|
//
|
||||||
// componentsToolStripMenuItemToolStripMenuItem
|
// componentsToolStripMenuItemToolStripMenuItem
|
||||||
//
|
//
|
||||||
this.componentsToolStripMenuItemToolStripMenuItem.Name = "componentsToolStripMenuItemToolStripMenuItem";
|
componentsToolStripMenuItemToolStripMenuItem.Name = "componentsToolStripMenuItemToolStripMenuItem";
|
||||||
this.componentsToolStripMenuItemToolStripMenuItem.Size = new System.Drawing.Size(180, 22);
|
componentsToolStripMenuItemToolStripMenuItem.Size = new Size(180, 22);
|
||||||
this.componentsToolStripMenuItemToolStripMenuItem.Text = "Компоненты";
|
componentsToolStripMenuItemToolStripMenuItem.Text = "Компоненты";
|
||||||
this.componentsToolStripMenuItemToolStripMenuItem.Click += new System.EventHandler(this.componentsToolStripMenuItem_Click);
|
componentsToolStripMenuItemToolStripMenuItem.Click += componentsToolStripMenuItem_Click;
|
||||||
|
componentsToolStripMenuItemToolStripMenuItem.Name = "componentsToolStripMenuItemToolStripMenuItem";
|
||||||
|
componentsToolStripMenuItemToolStripMenuItem.Size = new Size(145, 22);
|
||||||
|
componentsToolStripMenuItemToolStripMenuItem.Text = "Компоненты";
|
||||||
|
componentsToolStripMenuItemToolStripMenuItem.Click += componentsToolStripMenuItem_Click;
|
||||||
//
|
//
|
||||||
// sushiToolStripMenuItemToolStripMenuItem
|
// sushiToolStripMenuItemToolStripMenuItem
|
||||||
//
|
//
|
||||||
this.sushiToolStripMenuItemToolStripMenuItem.Name = "sushiToolStripMenuItemToolStripMenuItem";
|
sushiToolStripMenuItemToolStripMenuItem.Name = "sushiToolStripMenuItemToolStripMenuItem";
|
||||||
this.sushiToolStripMenuItemToolStripMenuItem.Size = new System.Drawing.Size(180, 22);
|
sushiToolStripMenuItemToolStripMenuItem.Size = new Size(180, 22);
|
||||||
this.sushiToolStripMenuItemToolStripMenuItem.Text = "Суши";
|
sushiToolStripMenuItemToolStripMenuItem.Text = "Суши";
|
||||||
this.sushiToolStripMenuItemToolStripMenuItem.Click += new System.EventHandler(this.sushiToolStripMenuItem_Click);
|
sushiToolStripMenuItemToolStripMenuItem.Click += sushiToolStripMenuItem_Click;
|
||||||
|
sushiToolStripMenuItemToolStripMenuItem.Name = "sushiToolStripMenuItemToolStripMenuItem";
|
||||||
|
sushiToolStripMenuItemToolStripMenuItem.Size = new Size(145, 22);
|
||||||
|
sushiToolStripMenuItemToolStripMenuItem.Text = "Суши";
|
||||||
|
sushiToolStripMenuItemToolStripMenuItem.Click += sushiToolStripMenuItem_Click;
|
||||||
//
|
//
|
||||||
// dataGridView
|
// магазиныToolStripMenuItem
|
||||||
//
|
//
|
||||||
this.dataGridView.BackgroundColor = System.Drawing.Color.White;
|
магазиныToolStripMenuItem.Name = "магазиныToolStripMenuItem";
|
||||||
this.dataGridView.ColumnHeadersHeightSizeMode = System.Windows.Forms.DataGridViewColumnHeadersHeightSizeMode.AutoSize;
|
магазиныToolStripMenuItem.Size = new Size(145, 22);
|
||||||
this.dataGridView.Location = new System.Drawing.Point(12, 27);
|
магазиныToolStripMenuItem.Text = "Магазины";
|
||||||
this.dataGridView.Name = "dataGridView";
|
магазиныToolStripMenuItem.Click += shopsToolStripMenuItem_Click;
|
||||||
this.dataGridView.RowTemplate.Height = 25;
|
|
||||||
this.dataGridView.Size = new System.Drawing.Size(647, 344);
|
|
||||||
this.dataGridView.TabIndex = 6;
|
|
||||||
//
|
//
|
||||||
// отчётыToolStripMenuItem
|
// отчётыToolStripMenuItem
|
||||||
//
|
//
|
||||||
this.отчётыToolStripMenuItem.DropDownItems.AddRange(new System.Windows.Forms.ToolStripItem[] {
|
отчётыToolStripMenuItem.DropDownItems.AddRange(new ToolStripItem[] { componentsToolStripMenuItem1, ordersToolStripMenuItem });
|
||||||
this.componentsToolStripMenuItem1,
|
отчётыToolStripMenuItem.Name = "отчётыToolStripMenuItem";
|
||||||
this.componentSushiToolStripMenuItem1,
|
отчётыToolStripMenuItem.Size = new Size(60, 20);
|
||||||
this.ordersToolStripMenuItem});
|
отчётыToolStripMenuItem.Text = "Отчёты";
|
||||||
this.отчётыToolStripMenuItem.Name = "отчётыToolStripMenuItem";
|
отчётыToolStripMenuItem.DropDownItems.AddRange(new ToolStripItem[] { componentsToolStripMenuItem1, ordersToolStripMenuItem, магазиныToolStripMenuItem1 });
|
||||||
this.отчётыToolStripMenuItem.Size = new System.Drawing.Size(60, 20);
|
отчётыToolStripMenuItem.Name = "отчётыToolStripMenuItem";
|
||||||
this.отчётыToolStripMenuItem.Text = "Отчёты";
|
отчётыToolStripMenuItem.Size = new Size(60, 20);
|
||||||
|
отчётыToolStripMenuItem.Text = "Отчёты";
|
||||||
//
|
//
|
||||||
// componentsToolStripMenuItem1
|
// componentsToolStripMenuItem1
|
||||||
//
|
//
|
||||||
this.componentsToolStripMenuItem1.Name = "componentsToolStripMenuItem1";
|
componentsToolStripMenuItem1.Name = "componentsToolStripMenuItem1";
|
||||||
this.componentsToolStripMenuItem1.Size = new System.Drawing.Size(205, 22);
|
componentsToolStripMenuItem1.Size = new Size(201, 22);
|
||||||
this.componentsToolStripMenuItem1.Text = "Суши";
|
componentsToolStripMenuItem1.Text = "Суши";
|
||||||
this.componentsToolStripMenuItem1.Click += new System.EventHandler(this.ComponentsToolStripMenuItem_Click);
|
componentsToolStripMenuItem1.Click += ComponentsToolStripMenuItem_Click;
|
||||||
|
componentsToolStripMenuItem1.DropDownItems.AddRange(new ToolStripItem[] { списокСушиToolStripMenuItem, сушиСИнгрToolStripMenuItem });
|
||||||
|
componentsToolStripMenuItem1.Name = "componentsToolStripMenuItem1";
|
||||||
|
componentsToolStripMenuItem1.Size = new Size(180, 22);
|
||||||
|
componentsToolStripMenuItem1.Text = "Суши";
|
||||||
|
componentsToolStripMenuItem1.Click += ComponentsToolStripMenuItem_Click;
|
||||||
|
//
|
||||||
|
// списокСушиToolStripMenuItem
|
||||||
|
//
|
||||||
|
списокСушиToolStripMenuItem.Name = "списокСушиToolStripMenuItem";
|
||||||
|
списокСушиToolStripMenuItem.Size = new Size(201, 22);
|
||||||
|
списокСушиToolStripMenuItem.Text = "Список суши";
|
||||||
|
списокСушиToolStripMenuItem.Click += ComponentsToolStripMenuItem_Click;
|
||||||
//
|
//
|
||||||
// сушиСИнгрToolStripMenuItem
|
// сушиСИнгрToolStripMenuItem
|
||||||
//
|
//
|
||||||
this.componentSushiToolStripMenuItem1.Name = "componentSushiToolStripMenuItem1";
|
/* componentSushiToolStripMenuItem1.Name = "componentSushiToolStripMenuItem1";
|
||||||
this.componentSushiToolStripMenuItem1.Size = new System.Drawing.Size(205, 22);
|
componentSushiToolStripMenuItem1.Size = new Size(201, 22);
|
||||||
this.componentSushiToolStripMenuItem1.Text = "Суши с компонентами";
|
componentSushiToolStripMenuItem1.Text = "Суши с компонентами";
|
||||||
this.componentSushiToolStripMenuItem1.Click += new System.EventHandler(this.ComponentSushiToolStripMenuItem_Click);
|
componentSushiToolStripMenuItem1.Click += ComponentSushiToolStripMenuItem_Click;
|
||||||
|
сушиСИнгрToolStripMenuItem.Name = "сушиСИнгрToolStripMenuItem";
|
||||||
|
сушиСИнгрToolStripMenuItem.Size = new Size(201, 22);
|
||||||
|
сушиСИнгрToolStripMenuItem.Text = "Суши с компонентами";
|
||||||
|
сушиСИнгрToolStripMenuItem.Click += ComponentSushiToolStripMenuItem_Click;*/
|
||||||
//
|
//
|
||||||
// ordersToolStripMenuItem
|
// ordersToolStripMenuItem
|
||||||
//
|
//
|
||||||
this.ordersToolStripMenuItem.Name = "ordersToolStripMenuItem";
|
ordersToolStripMenuItem.Name = "ordersToolStripMenuItem";
|
||||||
this.ordersToolStripMenuItem.Size = new System.Drawing.Size(205, 22);
|
ordersToolStripMenuItem.Size = new Size(201, 22);
|
||||||
this.ordersToolStripMenuItem.Text = "Заказы";
|
ordersToolStripMenuItem.Text = "Заказы";
|
||||||
this.ordersToolStripMenuItem.Click += new System.EventHandler(this.OrdersToolStripMenuItem_Click);
|
ordersToolStripMenuItem.Click += OrdersToolStripMenuItem_Click;
|
||||||
|
//
|
||||||
|
// dataGridView
|
||||||
|
//
|
||||||
|
dataGridView.BackgroundColor = Color.White;
|
||||||
|
dataGridView.ColumnHeadersHeightSizeMode = DataGridViewColumnHeadersHeightSizeMode.AutoSize;
|
||||||
|
dataGridView.Location = new Point(12, 27);
|
||||||
|
dataGridView.Name = "dataGridView";
|
||||||
|
dataGridView.RowTemplate.Height = 25;
|
||||||
|
dataGridView.Size = new Size(647, 344);
|
||||||
|
dataGridView.TabIndex = 6;
|
||||||
|
//
|
||||||
|
// ClientToolStripMenuItem
|
||||||
|
//
|
||||||
|
ClientToolStripMenuItem.Name = "ClientToolStripMenuItem";
|
||||||
|
ClientToolStripMenuItem.Size = new Size(180, 22);
|
||||||
|
ClientToolStripMenuItem.Text = "Клиенты";
|
||||||
|
ClientToolStripMenuItem.Click += ClientToolStripMenuItem_Click;
|
||||||
|
ordersToolStripMenuItem.DropDownItems.AddRange(new ToolStripItem[] { заказыToolStripMenuItem, заказыПоГруппамToolStripMenuItem });
|
||||||
|
ordersToolStripMenuItem.Name = "ordersToolStripMenuItem";
|
||||||
|
ordersToolStripMenuItem.Size = new Size(180, 22);
|
||||||
|
ordersToolStripMenuItem.Text = "Заказы";
|
||||||
|
ordersToolStripMenuItem.Click += OrdersToolStripMenuItem_Click;
|
||||||
|
//
|
||||||
|
// заказыToolStripMenuItem
|
||||||
|
//
|
||||||
|
заказыToolStripMenuItem.Name = "заказыToolStripMenuItem";
|
||||||
|
заказыToolStripMenuItem.Size = new Size(180, 22);
|
||||||
|
заказыToolStripMenuItem.Text = "Заказы";
|
||||||
|
заказыToolStripMenuItem.Click += OrdersToolStripMenuItem_Click;
|
||||||
|
//
|
||||||
|
// заказыПоГруппамToolStripMenuItem
|
||||||
|
//
|
||||||
|
заказыПоГруппамToolStripMenuItem.Name = "заказыПоГруппамToolStripMenuItem";
|
||||||
|
заказыПоГруппамToolStripMenuItem.Size = new Size(180, 22);
|
||||||
|
заказыПоГруппамToolStripMenuItem.Text = "Заказы по группам";
|
||||||
|
заказыПоГруппамToolStripMenuItem.Click += GroupOrdersToolStripMenuItem_Click;
|
||||||
|
//
|
||||||
|
// магазиныToolStripMenuItem1
|
||||||
|
//
|
||||||
|
магазиныToolStripMenuItem1.DropDownItems.AddRange(new ToolStripItem[] { информацияToolStripMenuItem, загруженностьToolStripMenuItem });
|
||||||
|
магазиныToolStripMenuItem1.Name = "магазиныToolStripMenuItem1";
|
||||||
|
магазиныToolStripMenuItem1.Size = new Size(180, 22);
|
||||||
|
магазиныToolStripMenuItem1.Text = "Магазины";
|
||||||
|
//
|
||||||
|
// информацияToolStripMenuItem
|
||||||
|
//
|
||||||
|
информацияToolStripMenuItem.Name = "информацияToolStripMenuItem";
|
||||||
|
информацияToolStripMenuItem.Size = new Size(180, 22);
|
||||||
|
информацияToolStripMenuItem.Text = "Информация ";
|
||||||
|
информацияToolStripMenuItem.Click += InfoToolStripMenuItem_Click;
|
||||||
|
//
|
||||||
|
// загруженностьToolStripMenuItem
|
||||||
|
//
|
||||||
|
загруженностьToolStripMenuItem.Name = "загруженностьToolStripMenuItem";
|
||||||
|
загруженностьToolStripMenuItem.Size = new Size(180, 22);
|
||||||
|
загруженностьToolStripMenuItem.Text = "Загруженность";
|
||||||
|
загруженностьToolStripMenuItem.Click += BusyShopsToolStripMenuItem_Click;
|
||||||
|
//
|
||||||
|
// операцииToolStripMenuItem
|
||||||
|
//
|
||||||
|
операцииToolStripMenuItem.DropDownItems.AddRange(new ToolStripItem[] { поставкаToolStripMenuItem, продажаToolStripMenuItem });
|
||||||
|
операцииToolStripMenuItem.Name = "операцииToolStripMenuItem";
|
||||||
|
операцииToolStripMenuItem.Size = new Size(75, 20);
|
||||||
|
операцииToolStripMenuItem.Text = "Операции";
|
||||||
|
//
|
||||||
|
// поставкаToolStripMenuItem
|
||||||
|
//
|
||||||
|
поставкаToolStripMenuItem.Name = "поставкаToolStripMenuItem";
|
||||||
|
поставкаToolStripMenuItem.Size = new Size(125, 22);
|
||||||
|
поставкаToolStripMenuItem.Text = "Поставка";
|
||||||
|
поставкаToolStripMenuItem.Click += transactionToolStripMenuItem_Click;
|
||||||
|
//
|
||||||
|
// продажаToolStripMenuItem
|
||||||
|
//
|
||||||
|
продажаToolStripMenuItem.Name = "продажаToolStripMenuItem";
|
||||||
|
продажаToolStripMenuItem.Size = new Size(125, 22);
|
||||||
|
продажаToolStripMenuItem.Text = "Продажа";
|
||||||
|
продажаToolStripMenuItem.Click += SellToolStripMenuItem_Click;
|
||||||
|
//
|
||||||
|
// dataGridView
|
||||||
|
//
|
||||||
|
dataGridView.BackgroundColor = Color.White;
|
||||||
|
dataGridView.ColumnHeadersHeightSizeMode = DataGridViewColumnHeadersHeightSizeMode.AutoSize;
|
||||||
|
dataGridView.Location = new Point(12, 27);
|
||||||
|
dataGridView.Name = "dataGridView";
|
||||||
|
dataGridView.RowTemplate.Height = 25;
|
||||||
|
dataGridView.Size = new Size(647, 344);
|
||||||
|
dataGridView.TabIndex = 6;
|
||||||
//
|
//
|
||||||
// FormMain
|
// FormMain
|
||||||
//
|
//
|
||||||
@ -236,5 +353,17 @@
|
|||||||
private ToolStripMenuItem отчётыToolStripMenuItem;
|
private ToolStripMenuItem отчётыToolStripMenuItem;
|
||||||
private ToolStripMenuItem componentsToolStripMenuItem1;
|
private ToolStripMenuItem componentsToolStripMenuItem1;
|
||||||
private ToolStripMenuItem ordersToolStripMenuItem;
|
private ToolStripMenuItem ordersToolStripMenuItem;
|
||||||
|
private ToolStripMenuItem ClientToolStripMenuItem;
|
||||||
|
private ToolStripMenuItem магазиныToolStripMenuItem;
|
||||||
|
private ToolStripMenuItem списокСушиToolStripMenuItem;
|
||||||
|
private ToolStripMenuItem сушиСИнгрToolStripMenuItem;
|
||||||
|
private ToolStripMenuItem заказыToolStripMenuItem;
|
||||||
|
private ToolStripMenuItem заказыПоГруппамToolStripMenuItem;
|
||||||
|
private ToolStripMenuItem магазиныToolStripMenuItem1;
|
||||||
|
private ToolStripMenuItem информацияToolStripMenuItem;
|
||||||
|
private ToolStripMenuItem загруженностьToolStripMenuItem;
|
||||||
|
private ToolStripMenuItem операцииToolStripMenuItem;
|
||||||
|
private ToolStripMenuItem поставкаToolStripMenuItem;
|
||||||
|
private ToolStripMenuItem продажаToolStripMenuItem;
|
||||||
}
|
}
|
||||||
}
|
}
|
@ -44,6 +44,9 @@ namespace SushiBarView
|
|||||||
services.AddTransient<IComponentStorage, ComponentStorage>();
|
services.AddTransient<IComponentStorage, ComponentStorage>();
|
||||||
services.AddTransient<IOrderStorage, OrderStorage>();
|
services.AddTransient<IOrderStorage, OrderStorage>();
|
||||||
services.AddTransient<ISushiStorage, SushiStorage>();
|
services.AddTransient<ISushiStorage, SushiStorage>();
|
||||||
|
services.AddTransient<IClientStorage, ClientStorage>();
|
||||||
|
|
||||||
|
services.AddTransient<IShopStorage, ShopStorage>();
|
||||||
services.AddTransient<IComponentLogic, ComponentLogic>();
|
services.AddTransient<IComponentLogic, ComponentLogic>();
|
||||||
services.AddTransient<IOrderLogic, OrderLogic>();
|
services.AddTransient<IOrderLogic, OrderLogic>();
|
||||||
services.AddTransient<ISushiLogic, SushiLogic>();
|
services.AddTransient<ISushiLogic, SushiLogic>();
|
||||||
@ -59,6 +62,9 @@ namespace SushiBarView
|
|||||||
services.AddTransient<FormReportOrders>();
|
services.AddTransient<FormReportOrders>();
|
||||||
services.AddTransient<FormReportSushiComponents>();
|
services.AddTransient<FormReportSushiComponents>();
|
||||||
services.AddTransient<IReportLogic, ReportLogic>();
|
services.AddTransient<IReportLogic, ReportLogic>();
|
||||||
|
services.AddTransient<FormClients>();
|
||||||
|
services.AddTransient<EntityFrameworkDesignServicesBuilder>();
|
||||||
|
services.AddTransient<IShopLogic, ShopLogic>();
|
||||||
|
|
||||||
services.AddTransient<AbstractSaveToWord, SaveToWord>();
|
services.AddTransient<AbstractSaveToWord, SaveToWord>();
|
||||||
services.AddTransient<AbstractSaveToExcel, SaveToExcel>();
|
services.AddTransient<AbstractSaveToExcel, SaveToExcel>();
|
||||||
|
Loading…
Reference in New Issue
Block a user