using LawFirmContracts.BindingModels; using LawFirmContracts.BusinessLogicContracts; using LawFirmContracts.SearchModels; using LawFirmContracts.ViewModels; using Microsoft.AspNetCore.Mvc; using System.ComponentModel.Design; namespace LawFirmRestApi.Controllers { [Route("api/[controller]/[action]")] [ApiController] public class CaseController : Controller { private readonly ILogger _logger; private readonly ICaseLogic _logic; private readonly IClientLogic _clientlogic; public CaseController(ICaseLogic logic, ILogger logger, IClientLogic clientlogic) { _logger = logger; _logic = logic; _clientlogic = clientlogic; } [HttpGet] public List? GetCaseList(int executorId) { try { return _logic.ReadList(new CaseSearchModel { ExecutorId = executorId }); } catch (Exception ex) { _logger.LogError(ex, "Ошибка получения списка продуктов"); throw; } } [HttpPost] public void CreateCase(CaseBindingModel model) { try { _logic.CreateCase(model); } catch (Exception ex) { _logger.LogError(ex, "Ошибка создания заказа"); throw; } } [HttpPost] public void UpdateCase(CaseBindingModel model) { try { _logic.Update(model); } catch (Exception ex) { _logger.LogError(ex, "Ошибка создания заказа"); throw; } } [HttpPost] public void AnalysisCase(CaseBindingModel model) { try { //возможно переделаю метод _logic.CaseAnalysis(model); } catch (Exception ex) { _logger.LogError(ex, "Ошибка создания заказа"); throw; } } [HttpPost] public void HearingCase(CaseBindingModel model) { try { //возможно переделаю метод _logic.CaseHearing(model); } catch (Exception ex) { _logger.LogError(ex, "Ошибка создания заказа"); throw; } } [HttpPost] public void CloseCase(CaseBindingModel model) { try { _logic.CloseCase(model); } catch (Exception ex) { _logger.LogError(ex, "Ошибка создания заказа"); throw; } } [HttpPost] public void DeleteCase(CaseBindingModel model) { try { _logic.DeleteCase(model); } catch (Exception ex) { _logger.LogError(ex, "Ошибка создания заказа"); throw; } } [HttpPost] public void AddClientToCase(Tuple model) { try { _logic.AddClientToCase(model.Item1, model.Item2); } catch (Exception ex) { _logger.LogError(ex, "Ошибка создания заказа"); throw; } } [HttpGet] public List? GetClientListToCase(int caseId) { try { return _clientlogic.ReadCaseElementList(new CaseSearchModel { Id = caseId }); } catch (Exception ex) { _logger.LogError(ex, "Ошибка получения списка продуктов"); throw; } } } }