From 3131e7626c15047ba3ee542f1c95d3857448b6fd Mon Sep 17 00:00:00 2001 From: Yuee Shiness Date: Fri, 19 May 2023 16:50:15 +0400 Subject: [PATCH] RestAPI new methods. --- .../Controllers/MainController.cs | 42 ++++++++++--------- 1 file changed, 23 insertions(+), 19 deletions(-) diff --git a/ComputerStoreRestAPI/Controllers/MainController.cs b/ComputerStoreRestAPI/Controllers/MainController.cs index 948c9b4..2948087 100644 --- a/ComputerStoreRestAPI/Controllers/MainController.cs +++ b/ComputerStoreRestAPI/Controllers/MainController.cs @@ -3,6 +3,7 @@ using ComputerStoreContracts.BusinessLogicContracts; using ComputerStoreContracts.SearchModels; using ComputerStoreContracts.ViewModels; using Microsoft.AspNetCore.Mvc; +using System.Windows; namespace ComputerStoreRestAPI.Controllers { @@ -24,12 +25,12 @@ namespace ComputerStoreRestAPI.Controllers public MainController( - ILogger logger, - IComponentLogic componentLogic, - IPCLogic pcLogic, - IProductLogic productLogic, - IEmployeeReportLogic employeeReportLogic, - IRequestComponentLogic requestComponentLogic, + ILogger logger, + IComponentLogic componentLogic, + IPCLogic pcLogic, + IProductLogic productLogic, + IEmployeeReportLogic employeeReportLogic, + IRequestComponentLogic requestComponentLogic, IRequestLogic requestLogic, IOrderLogic orderLogic, IConsignmentLogic consignmentLogic, @@ -54,7 +55,7 @@ namespace ComputerStoreRestAPI.Controllers { return _componentLogic.ReadList(null); } - catch(Exception ex) + catch (Exception ex) { _logger.LogError(ex, "Receiving list of components error."); throw; @@ -66,7 +67,7 @@ namespace ComputerStoreRestAPI.Controllers { try { - return _componentLogic.ReadElement(new ComponentSearchModel { ID = id } ); + return _componentLogic.ReadElement(new ComponentSearchModel { ID = id }); } catch (Exception ex) { @@ -82,7 +83,7 @@ namespace ComputerStoreRestAPI.Controllers { return _componentLogic.Delete(new ComponentBindingModel { ID = id }); } - catch(Exception ex) + catch (Exception ex) { _logger.LogError(ex, "Removing component error."); throw; @@ -106,11 +107,11 @@ namespace ComputerStoreRestAPI.Controllers [HttpPost] public bool InsertComponent(ComponentBindingModel component) { - try + try { return _componentLogic.Create(component); } - catch(Exception ex) + catch (Exception ex) { _logger.LogError(ex, "Inserting component error."); throw; @@ -192,7 +193,7 @@ namespace ComputerStoreRestAPI.Controllers { try { - return _pcLogic.Delete(new PCBindingModel { ID = id}); + return _pcLogic.Delete(new PCBindingModel { ID = id }); } catch (Exception ex) { @@ -234,7 +235,7 @@ namespace ComputerStoreRestAPI.Controllers { try { - return _requestComponentLogic.ReadList(new RequestSearchModel { ID = id}); + return _requestComponentLogic.ReadList(new RequestSearchModel { ID = id }); } catch (Exception ex) { @@ -243,13 +244,16 @@ namespace ComputerStoreRestAPI.Controllers } } + + [HttpGet] + public List GetReportConsignmentsList(ReportComponentsBindingModel model) + { + return _employeeReportLogic.GetConsignmentsByComponents(model); + } + - - - - - #region Request - [HttpGet] + #region Request + [HttpGet] public List? GetRequestList() { try