From dc3dab57bab802a16feb0d2d691cf390c1066eba Mon Sep 17 00:00:00 2001 From: devil_1nc Date: Sat, 20 May 2023 09:50:02 +0400 Subject: [PATCH] controllers edit --- .../ComputerShopRestApi.csproj | 15 +++ .../Properties/Resources.Designer.cs | 63 +++++++++++ .../Properties/Resources.resx | 101 ++++++++++++++++++ .../Controllers/HomeController.cs | 27 ++--- 4 files changed, 193 insertions(+), 13 deletions(-) create mode 100644 ComputerShopProvider/ComputerShopRestApi/Properties/Resources.Designer.cs create mode 100644 ComputerShopProvider/ComputerShopRestApi/Properties/Resources.resx diff --git a/ComputerShopProvider/ComputerShopRestApi/ComputerShopRestApi.csproj b/ComputerShopProvider/ComputerShopRestApi/ComputerShopRestApi.csproj index 64e76d1..1f0e345 100644 --- a/ComputerShopProvider/ComputerShopRestApi/ComputerShopRestApi.csproj +++ b/ComputerShopProvider/ComputerShopRestApi/ComputerShopRestApi.csproj @@ -17,4 +17,19 @@ + + + True + True + Resources.resx + + + + + + ResXFileCodeGenerator + Resources.Designer.cs + + + diff --git a/ComputerShopProvider/ComputerShopRestApi/Properties/Resources.Designer.cs b/ComputerShopProvider/ComputerShopRestApi/Properties/Resources.Designer.cs new file mode 100644 index 0000000..81e2b38 --- /dev/null +++ b/ComputerShopProvider/ComputerShopRestApi/Properties/Resources.Designer.cs @@ -0,0 +1,63 @@ +//------------------------------------------------------------------------------ +// +// Этот код создан программой. +// Исполняемая версия:4.0.30319.42000 +// +// Изменения в этом файле могут привести к неправильной работе и будут потеряны в случае +// повторной генерации кода. +// +//------------------------------------------------------------------------------ + +namespace ComputerShopRestApi.Properties { + using System; + + + /// + /// Класс ресурса со строгой типизацией для поиска локализованных строк и т.д. + /// + // Этот класс создан автоматически классом StronglyTypedResourceBuilder + // с помощью такого средства, как ResGen или Visual Studio. + // Чтобы добавить или удалить член, измените файл .ResX и снова запустите ResGen + // с параметром /str или перестройте свой проект VS. + [global::System.CodeDom.Compiler.GeneratedCodeAttribute("System.Resources.Tools.StronglyTypedResourceBuilder", "17.0.0.0")] + [global::System.Diagnostics.DebuggerNonUserCodeAttribute()] + [global::System.Runtime.CompilerServices.CompilerGeneratedAttribute()] + internal class Resources { + + private static global::System.Resources.ResourceManager resourceMan; + + private static global::System.Globalization.CultureInfo resourceCulture; + + [global::System.Diagnostics.CodeAnalysis.SuppressMessageAttribute("Microsoft.Performance", "CA1811:AvoidUncalledPrivateCode")] + internal Resources() { + } + + /// + /// Возвращает кэшированный экземпляр ResourceManager, использованный этим классом. + /// + [global::System.ComponentModel.EditorBrowsableAttribute(global::System.ComponentModel.EditorBrowsableState.Advanced)] + internal static global::System.Resources.ResourceManager ResourceManager { + get { + if (object.ReferenceEquals(resourceMan, null)) { + global::System.Resources.ResourceManager temp = new global::System.Resources.ResourceManager("ComputerShopRestApi.Properties.Resources", typeof(Resources).Assembly); + resourceMan = temp; + } + return resourceMan; + } + } + + /// + /// Перезаписывает свойство CurrentUICulture текущего потока для всех + /// обращений к ресурсу с помощью этого класса ресурса со строгой типизацией. + /// + [global::System.ComponentModel.EditorBrowsableAttribute(global::System.ComponentModel.EditorBrowsableState.Advanced)] + internal static global::System.Globalization.CultureInfo Culture { + get { + return resourceCulture; + } + set { + resourceCulture = value; + } + } + } +} diff --git a/ComputerShopProvider/ComputerShopRestApi/Properties/Resources.resx b/ComputerShopProvider/ComputerShopRestApi/Properties/Resources.resx new file mode 100644 index 0000000..4fdb1b6 --- /dev/null +++ b/ComputerShopProvider/ComputerShopRestApi/Properties/Resources.resx @@ -0,0 +1,101 @@ + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + text/microsoft-resx + + + 1.3 + + + System.Resources.ResXResourceReader, System.Windows.Forms, Version=2.0.3500.0, Culture=neutral, PublicKeyToken=b77a5c561934e089 + + + System.Resources.ResXResourceWriter, System.Windows.Forms, Version=2.0.3500.0, Culture=neutral, PublicKeyToken=b77a5c561934e089 + + \ No newline at end of file diff --git a/ComputerShopProvider/OrdererClientApp/Controllers/HomeController.cs b/ComputerShopProvider/OrdererClientApp/Controllers/HomeController.cs index aa2f29a..7160e6c 100644 --- a/ComputerShopProvider/OrdererClientApp/Controllers/HomeController.cs +++ b/ComputerShopProvider/OrdererClientApp/Controllers/HomeController.cs @@ -21,24 +21,24 @@ namespace OrdererClientApp.Controllers { return Redirect("~/Home/Enter"); } - return View(APIClient.GetRequest>($"api/main/getpurchases?clientId={APIClient.Client.Id}")); + return View(APIClient.GetRequest>($"api/main/getreceivings?clientId={APIClient.Client.Id}")); } - public IActionResult Component() + public IActionResult Order() { if (APIClient.Client == null) { return Redirect("~/Home/Enter"); } - return View(APIClient.GetRequest>($"api/component/getcomponentlist")); + return View(APIClient.GetRequest>($"api/component/getorderlist")); } - public IActionResult Assembly() + public IActionResult Supply() { if (APIClient.Client == null) { return Redirect("~/Home/Enter"); } - return View(APIClient.GetRequest>($"api/assembly/getassemblylist")); + return View(APIClient.GetRequest>($"api/assembly/getsupplylist")); } [HttpGet] @@ -164,26 +164,27 @@ namespace OrdererClientApp.Controllers APIClient.PostRequest("api/order/createorder", new OrderBindingModel { ClientId = APIClient.Client.Id, + Sum = sum }); Response.Redirect("Index"); } [HttpGet] - public IActionResult DeleteComponent() + public IActionResult DeleteOrder() { - ViewBag.Components = APIClient.GetRequest>("api/main/getcomponentlist"); + ViewBag.Components = APIClient.GetRequest>("api/main/getorderlist"); return View(); } [HttpDelete] - public void DeleteComponent(int component) + public void DeleteOrder(int order) { if (APIClient.Client == null) { throw new Exception("Вы как суда попали? Суда вход только авторизованным"); } - APIClient.PostRequest("api/component/deletecomponent", new ComponentBindingModel + APIClient.PostRequest("api/component/deleteorder", new ComponentBindingModel { - Id = component + Id = order }); Response.Redirect("Index"); } @@ -221,10 +222,10 @@ namespace OrdererClientApp.Controllers [HttpPost] - public double Calc(int count, int component) + public double Calc(int count, int order) { - var comp = APIClient.GetRequest($"api/main/getcomponent?componentId={component}"); - return count * (comp?.Cost ?? 1); + var or = APIClient.GetRequest($"api/main/getcomponent?componentId={order}"); + return count * (or?.Sum ?? 1); } } } \ No newline at end of file