так2
This commit is contained in:
parent
aef701ae24
commit
42f8415d34
@ -4,6 +4,7 @@ using ComputerShopContracts.SearchModels;
|
||||
using ComputerShopContracts.ViewModels;
|
||||
using Microsoft.AspNetCore.Http;
|
||||
using Microsoft.AspNetCore.Mvc;
|
||||
using System.Reflection;
|
||||
|
||||
namespace ComputerShopRestApi.Controllers
|
||||
{
|
||||
@ -13,13 +14,11 @@ namespace ComputerShopRestApi.Controllers
|
||||
{
|
||||
private readonly ILogger _logger;
|
||||
private readonly IOrderLogic _order;
|
||||
private readonly ISupplyLogic _supply;
|
||||
|
||||
public OrderController(ILogger<MainController> logger, IOrderLogic order, ISupplyLogic supply)
|
||||
{
|
||||
_logger = logger;
|
||||
_order = order;
|
||||
_supply = supply;
|
||||
}
|
||||
|
||||
[HttpGet]
|
||||
@ -36,19 +35,6 @@ namespace ComputerShopRestApi.Controllers
|
||||
throw;
|
||||
}
|
||||
}
|
||||
[HttpGet]
|
||||
public List<SupplyViewModel>? GetSuppliesList()
|
||||
{
|
||||
try
|
||||
{
|
||||
return _supply.ReadList(null);
|
||||
}
|
||||
catch (Exception ex)
|
||||
{
|
||||
_logger.LogError(ex, "Ошибка получения списка компонентов");
|
||||
throw;
|
||||
}
|
||||
}
|
||||
|
||||
[HttpGet]
|
||||
public List<OrderViewModel>? GetOrders(int clientId)
|
||||
@ -90,5 +76,19 @@ namespace ComputerShopRestApi.Controllers
|
||||
throw;
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
[HttpPost]
|
||||
public void AddAssembly(Tuple<OrderSearchModel, AssemblySearchModel, int> model)
|
||||
{
|
||||
try
|
||||
{
|
||||
_order.AddAssembly(model.Item1, model.Item2, model.Item3);
|
||||
}
|
||||
catch (Exception ex)
|
||||
{
|
||||
_logger.LogError(ex, "Ошибка добавления компонента в сборку.");
|
||||
throw;
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
|
@ -220,13 +220,13 @@ namespace OrdererClientApp.Controllers
|
||||
}
|
||||
|
||||
[HttpPost]
|
||||
public void AddAssemblyToOrder(int order, int assembly, int amount)
|
||||
public void AddAssembly(int order, int assembly, int amount)
|
||||
{
|
||||
if (APIClient.Client == null)
|
||||
{
|
||||
throw new Exception("Необходима авторизация");
|
||||
}
|
||||
APIClient.PostRequest("api/order/AddAssemblyToOrder", Tuple.Create(
|
||||
APIClient.PostRequest("api/order/AddAssembly", Tuple.Create(
|
||||
new AssemblySearchModel() { Id = assembly },
|
||||
new OrderSearchModel() { Id = order },
|
||||
|
||||
|
Loading…
Reference in New Issue
Block a user