2024-05-25 17:47:14 +04:00
|
|
|
|
using ElectronicsShopContracts.BindingModels;
|
2024-05-27 17:35:14 +04:00
|
|
|
|
using ElectronicsShopContracts.BusinessLogicContracts;
|
|
|
|
|
using ElectronicsShopContracts.SearchModels;
|
2024-05-25 17:47:14 +04:00
|
|
|
|
using ElectronicsShopContracts.ViewModels;
|
|
|
|
|
using Microsoft.AspNetCore.Mvc;
|
2024-04-29 21:57:01 +04:00
|
|
|
|
|
2024-05-27 17:35:14 +04:00
|
|
|
|
namespace ElectronicsShopRestAPI.Controllers {
|
2024-05-25 17:47:14 +04:00
|
|
|
|
|
|
|
|
|
[Route("api/[controller]/[action]")]
|
|
|
|
|
[ApiController]
|
2024-04-29 21:57:01 +04:00
|
|
|
|
public class MainController : Controller {
|
2024-05-25 17:47:14 +04:00
|
|
|
|
|
|
|
|
|
private readonly ILogger _logger;
|
2024-05-27 17:35:14 +04:00
|
|
|
|
private readonly IProductLogic _product;
|
2024-05-25 17:47:14 +04:00
|
|
|
|
|
2024-05-27 17:35:14 +04:00
|
|
|
|
public MainController(ILogger<MainController> logger, IProductLogic product) {
|
2024-05-25 17:47:14 +04:00
|
|
|
|
_logger = logger;
|
2024-05-27 17:35:14 +04:00
|
|
|
|
_product = product;
|
2024-05-25 17:47:14 +04:00
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
[HttpGet]
|
|
|
|
|
public List<ProductViewModel>? GetProductList() {
|
|
|
|
|
//tdoo
|
|
|
|
|
return null;
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
[HttpGet]
|
|
|
|
|
public ProductViewModel? GetProduct(int ProductID) {
|
|
|
|
|
return null;
|
2024-04-29 21:57:01 +04:00
|
|
|
|
}
|
2024-05-25 17:47:14 +04:00
|
|
|
|
|
|
|
|
|
|
|
|
|
|
// клиент должен получать свои заказы
|
|
|
|
|
// сотрудник должен получать все заказы
|
|
|
|
|
[HttpGet]
|
2024-05-27 17:35:14 +04:00
|
|
|
|
public List<OrderViewModel>? GetOrders(int _clientID) {
|
2024-05-25 17:47:14 +04:00
|
|
|
|
return null;
|
|
|
|
|
}
|
|
|
|
|
|
2024-05-27 17:35:14 +04:00
|
|
|
|
[HttpGet]
|
|
|
|
|
public List<ProductViewModel>? GetProducts() {
|
|
|
|
|
try {
|
|
|
|
|
return _product.ReadList(new ProductSearchModel {});
|
|
|
|
|
}
|
|
|
|
|
catch (Exception ex) {
|
|
|
|
|
_logger.LogError(ex, $"Ошибка получения данных");
|
|
|
|
|
throw;
|
|
|
|
|
}
|
|
|
|
|
}
|
|
|
|
|
|
2024-05-25 17:47:14 +04:00
|
|
|
|
[HttpPost]
|
|
|
|
|
public void CreateOrder(OrderBindingModel model) {
|
|
|
|
|
return;
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
[HttpPost]
|
|
|
|
|
public void CreateProduct(OrderBindingModel model) {
|
|
|
|
|
return;
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
//Мейби нужны будут удаления, обновления, выбор конкретного заказа или продукта. Короче потом....
|
2024-04-29 21:57:01 +04:00
|
|
|
|
}
|
|
|
|
|
}
|