Merge branch 'CourseworkRestAPI' into CourseworkEmployeeApp

This commit is contained in:
Yuee Shiness 2023-05-19 16:56:43 +04:00
commit 30663c7429

View File

@ -248,12 +248,77 @@ namespace ComputerStoreRestAPI.Controllers
}
[HttpGet]
public List<ReportConsignmentsViewModel> GetReportConsignmentsList(ReportComponentsBindingModel model)
{
return _employeeReportLogic.GetConsignmentsByComponents(model);
}
#region Consignment
[HttpGet]
public List<ConsignmentViewModel>? GetConsignmentList()
{
try
{
return _consignmentLogic.ReadList(null);
}
catch (Exception ex)
{
_logger.LogError(ex, "Receiving list of consignment error.");
throw;
}
}
[HttpGet]
public ConsignmentViewModel? GetConsignment(int id)
{
try
{
return _consignmentLogic.ReadElement(new ConsignmentSearchModel { ID = id });
}
catch (Exception ex)
{
_logger.LogError(ex, "Receiving consignment error.");
throw;
}
}
[HttpDelete("{id}")]
public bool DeleteConsignment(int id)
{
try
{
return _consignmentLogic.Delete(new ConsignmentBindingModel { ID = id });
}
catch (Exception ex)
{
_logger.LogError(ex, "Removing consignment error.");
throw;
}
}
[HttpPatch]
public bool UpdateConsignment(ConsignmentBindingModel consignment)
{
try
{
return _consignmentLogic.Update(consignment);
}
catch (Exception ex)
{
_logger.LogError(ex, "Updating consignment error.");
throw;
}
}
[HttpPost]
public bool InsertConsignment(ConsignmentBindingModel consignment)
{
try
{
return _consignmentLogic.Create(consignment);
}
catch (Exception ex)
{
_logger.LogError(ex, "Inserting consignment error.");
throw;
}
}
#endregion
#region Request
[HttpGet]
@ -327,8 +392,6 @@ namespace ComputerStoreRestAPI.Controllers
}
#endregion
#region Order
[HttpGet]
public List<OrderViewModel>? GetOrdersList()
@ -344,6 +407,48 @@ namespace ComputerStoreRestAPI.Controllers
}
}
[HttpGet]
public OrderViewModel? GetOrder(int id)
{
try
{
return _orderLogic.ReadElement(new OrderSearchModel { ID = id });
}
catch (Exception ex)
{
_logger.LogError(ex, "Receiving order error.");
throw;
}
}
[HttpDelete("{id}")]
public bool DeleteOrder(int id)
{
try
{
return _orderLogic.DeleteOrder(new OrderBindingModel { ID = id });
}
catch (Exception ex)
{
_logger.LogError(ex, "Removing order error.");
throw;
}
}
[HttpPatch]
public bool UpdateOrder(OrderBindingModel order)
{
try
{
return _orderLogic.UpdateOrder(order);
}
catch (Exception ex)
{
_logger.LogError(ex, "Updating order error.");
throw;
}
}
[HttpPatch]
public bool UpdateOrderInProcess(OrderBindingModel order)
{