This commit is contained in:
ValAnn 2024-05-08 14:05:44 +04:00
parent 5ed879f53e
commit e90f31fcd3
15 changed files with 524 additions and 232 deletions

View File

@ -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
} }
} }
} }
} }

View File

@ -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 });
}
}
}

View File

@ -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>

View 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>
}
}

View 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>

View File

@ -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">
&copy; 2024 - SushiBarClientApp - <a asp-area="" asp-controller="Home" asp-action="Privacy">Privacy</a> &copy; 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>

View 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();
}
}

View 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();
}
}

View File

@ -12,13 +12,8 @@ using SushiBarDatabaseImplement;
namespace SushiBarDatabaseImplement.Migrations namespace SushiBarDatabaseImplement.Migrations
{ {
[DbContext(typeof(SushiBarDatabase))] [DbContext(typeof(SushiBarDatabase))]
<<<<<<<< HEAD:SushiBar/SushiBarDatabaseImplement/Migrations/20240420142132_InitialCreate.Designer.cs [Migration("20240508053719_InitCreate")]
[Migration("20240420142132_InitialCreate")]
partial class InitialCreate
========
[Migration("20240424121819_InitCreate")]
partial class InitCreate partial class InitCreate
>>>>>>>> Lab_4_Hard:SushiBar/SushiBarDatabaseImplement/Migrations/20240424121819_InitCreate.Designer.cs
{ {
/// <inheritdoc /> /// <inheritdoc />
protected override void BuildTargetModel(ModelBuilder modelBuilder) protected override void BuildTargetModel(ModelBuilder modelBuilder)

View File

@ -199,11 +199,10 @@ namespace SushiBarDatabaseImplement.Migrations
name: "SushiComponents"); name: "SushiComponents");
migrationBuilder.DropTable( migrationBuilder.DropTable(
<<<<<<<< HEAD:SushiBar/SushiBarDatabaseImplement/Migrations/20240420142132_InitialCreate.cs
name: "Clients"); name: "Clients");
========
migrationBuilder.DropTable(
name: "Shops"); name: "Shops");
>>>>>>>> Lab_4_Hard:SushiBar/SushiBarDatabaseImplement/Migrations/20240424121819_InitCreate.cs
migrationBuilder.DropTable( migrationBuilder.DropTable(
name: "Components"); name: "Components");

View File

@ -0,0 +1,12 @@
namespace SushiBarRestApi
{
public class APIConfig
{
public static string? ShopPassword;
public static void LoadData(IConfiguration configuration)
{
ShopPassword = configuration["ShopAPIPassword"];
}
}
}

View 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;
}
}
}

View File

@ -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())
{ {

View File

@ -5,5 +5,7 @@
"Microsoft.AspNetCore": "Warning" "Microsoft.AspNetCore": "Warning"
} }
}, },
"AllowedHosts": "*" "AllowedHosts": "*",
"ShopAPIPassword": "123456"
} }

View File

@ -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();
@ -181,7 +181,7 @@
// //
// отчётыToolStripMenuItem // отчётыToolStripMenuItem
// //
отчётыToolStripMenuItem.DropDownItems.AddRange(new ToolStripItem[] { componentsToolStripMenuItem1, componentSushiToolStripMenuItem1, ordersToolStripMenuItem }); отчётыToolStripMenuItem.DropDownItems.AddRange(new ToolStripItem[] { componentsToolStripMenuItem1, ordersToolStripMenuItem });
отчётыToolStripMenuItem.Name = "отчётыToolStripMenuItem"; отчётыToolStripMenuItem.Name = "отчётыToolStripMenuItem";
отчётыToolStripMenuItem.Size = new Size(60, 20); отчётыToolStripMenuItem.Size = new Size(60, 20);
отчётыToolStripMenuItem.Text = "Отчёты"; отчётыToolStripMenuItem.Text = "Отчёты";
@ -211,14 +211,14 @@
// //
// сушиСИнгрToolStripMenuItem // сушиСИнгрToolStripMenuItem
// //
componentSushiToolStripMenuItem1.Name = "componentSushiToolStripMenuItem1"; /* componentSushiToolStripMenuItem1.Name = "componentSushiToolStripMenuItem1";
componentSushiToolStripMenuItem1.Size = new Size(201, 22); componentSushiToolStripMenuItem1.Size = new Size(201, 22);
componentSushiToolStripMenuItem1.Text = "Суши с компонентами"; componentSushiToolStripMenuItem1.Text = "Суши с компонентами";
componentSushiToolStripMenuItem1.Click += ComponentSushiToolStripMenuItem_Click; componentSushiToolStripMenuItem1.Click += ComponentSushiToolStripMenuItem_Click;
сушиСИнгрToolStripMenuItem.Name = "сушиСИнгрToolStripMenuItem"; сушиСИнгрToolStripMenuItem.Name = "сушиСИнгрToolStripMenuItem";
сушиСИнгрToolStripMenuItem.Size = new Size(201, 22); сушиСИнгрToolStripMenuItem.Size = new Size(201, 22);
сушиСИнгрToolStripMenuItem.Text = "Суши с компонентами"; сушиСИнгрToolStripMenuItem.Text = "Суши с компонентами";
сушиСИнгрToolStripMenuItem.Click += ComponentSushiToolStripMenuItem_Click; сушиСИнгрToolStripMenuItem.Click += ComponentSushiToolStripMenuItem_Click;*/
// //
// ordersToolStripMenuItem // ordersToolStripMenuItem
// //