RestAPI new methods.
This commit is contained in:
parent
2a1d3bb6fa
commit
3131e7626c
@ -3,6 +3,7 @@ using ComputerStoreContracts.BusinessLogicContracts;
|
|||||||
using ComputerStoreContracts.SearchModels;
|
using ComputerStoreContracts.SearchModels;
|
||||||
using ComputerStoreContracts.ViewModels;
|
using ComputerStoreContracts.ViewModels;
|
||||||
using Microsoft.AspNetCore.Mvc;
|
using Microsoft.AspNetCore.Mvc;
|
||||||
|
using System.Windows;
|
||||||
|
|
||||||
namespace ComputerStoreRestAPI.Controllers
|
namespace ComputerStoreRestAPI.Controllers
|
||||||
{
|
{
|
||||||
@ -24,12 +25,12 @@ namespace ComputerStoreRestAPI.Controllers
|
|||||||
|
|
||||||
|
|
||||||
public MainController(
|
public MainController(
|
||||||
ILogger<MainController> logger,
|
ILogger<MainController> logger,
|
||||||
IComponentLogic componentLogic,
|
IComponentLogic componentLogic,
|
||||||
IPCLogic pcLogic,
|
IPCLogic pcLogic,
|
||||||
IProductLogic productLogic,
|
IProductLogic productLogic,
|
||||||
IEmployeeReportLogic employeeReportLogic,
|
IEmployeeReportLogic employeeReportLogic,
|
||||||
IRequestComponentLogic requestComponentLogic,
|
IRequestComponentLogic requestComponentLogic,
|
||||||
IRequestLogic requestLogic,
|
IRequestLogic requestLogic,
|
||||||
IOrderLogic orderLogic,
|
IOrderLogic orderLogic,
|
||||||
IConsignmentLogic consignmentLogic,
|
IConsignmentLogic consignmentLogic,
|
||||||
@ -54,7 +55,7 @@ namespace ComputerStoreRestAPI.Controllers
|
|||||||
{
|
{
|
||||||
return _componentLogic.ReadList(null);
|
return _componentLogic.ReadList(null);
|
||||||
}
|
}
|
||||||
catch(Exception ex)
|
catch (Exception ex)
|
||||||
{
|
{
|
||||||
_logger.LogError(ex, "Receiving list of components error.");
|
_logger.LogError(ex, "Receiving list of components error.");
|
||||||
throw;
|
throw;
|
||||||
@ -66,7 +67,7 @@ namespace ComputerStoreRestAPI.Controllers
|
|||||||
{
|
{
|
||||||
try
|
try
|
||||||
{
|
{
|
||||||
return _componentLogic.ReadElement(new ComponentSearchModel { ID = id } );
|
return _componentLogic.ReadElement(new ComponentSearchModel { ID = id });
|
||||||
}
|
}
|
||||||
catch (Exception ex)
|
catch (Exception ex)
|
||||||
{
|
{
|
||||||
@ -82,7 +83,7 @@ namespace ComputerStoreRestAPI.Controllers
|
|||||||
{
|
{
|
||||||
return _componentLogic.Delete(new ComponentBindingModel { ID = id });
|
return _componentLogic.Delete(new ComponentBindingModel { ID = id });
|
||||||
}
|
}
|
||||||
catch(Exception ex)
|
catch (Exception ex)
|
||||||
{
|
{
|
||||||
_logger.LogError(ex, "Removing component error.");
|
_logger.LogError(ex, "Removing component error.");
|
||||||
throw;
|
throw;
|
||||||
@ -106,11 +107,11 @@ namespace ComputerStoreRestAPI.Controllers
|
|||||||
[HttpPost]
|
[HttpPost]
|
||||||
public bool InsertComponent(ComponentBindingModel component)
|
public bool InsertComponent(ComponentBindingModel component)
|
||||||
{
|
{
|
||||||
try
|
try
|
||||||
{
|
{
|
||||||
return _componentLogic.Create(component);
|
return _componentLogic.Create(component);
|
||||||
}
|
}
|
||||||
catch(Exception ex)
|
catch (Exception ex)
|
||||||
{
|
{
|
||||||
_logger.LogError(ex, "Inserting component error.");
|
_logger.LogError(ex, "Inserting component error.");
|
||||||
throw;
|
throw;
|
||||||
@ -192,7 +193,7 @@ namespace ComputerStoreRestAPI.Controllers
|
|||||||
{
|
{
|
||||||
try
|
try
|
||||||
{
|
{
|
||||||
return _pcLogic.Delete(new PCBindingModel { ID = id});
|
return _pcLogic.Delete(new PCBindingModel { ID = id });
|
||||||
}
|
}
|
||||||
catch (Exception ex)
|
catch (Exception ex)
|
||||||
{
|
{
|
||||||
@ -234,7 +235,7 @@ namespace ComputerStoreRestAPI.Controllers
|
|||||||
{
|
{
|
||||||
try
|
try
|
||||||
{
|
{
|
||||||
return _requestComponentLogic.ReadList(new RequestSearchModel { ID = id});
|
return _requestComponentLogic.ReadList(new RequestSearchModel { ID = id });
|
||||||
}
|
}
|
||||||
catch (Exception ex)
|
catch (Exception ex)
|
||||||
{
|
{
|
||||||
@ -243,13 +244,16 @@ namespace ComputerStoreRestAPI.Controllers
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
|
[HttpGet]
|
||||||
|
public List<ReportConsignmentsViewModel> GetReportConsignmentsList(ReportComponentsBindingModel model)
|
||||||
|
{
|
||||||
|
return _employeeReportLogic.GetConsignmentsByComponents(model);
|
||||||
|
}
|
||||||
|
|
||||||
|
|
||||||
|
#region Request
|
||||||
|
[HttpGet]
|
||||||
|
|
||||||
|
|
||||||
#region Request
|
|
||||||
[HttpGet]
|
|
||||||
public List<RequestViewModel>? GetRequestList()
|
public List<RequestViewModel>? GetRequestList()
|
||||||
{
|
{
|
||||||
try
|
try
|
||||||
|
Loading…
Reference in New Issue
Block a user