using FactoryContracts.BindingModels; using FactoryContracts.BusinessLogicsContracts; using FactoryContracts.SearchModels; using FactoryContracts.StoragesContracts; using FactoryContracts.ViewModels; using FactoryDatabaseImplement.Models; using Microsoft.AspNetCore.Mvc; using System.Numerics; namespace FactoryRestAPI.Controllers { [ApiController] [Route("api/[controller]/[action]")] public class ReadController : ControllerBase { private readonly ILogger _logger; private readonly IMasterLogic _masterLogic; private readonly IComponentLogic _componentLogic; private readonly IEngenierLogic _engenierLogic; private readonly ILatheBusyLogic _latheBusyLogic; private readonly ILatheLogic _latheLogic; private readonly IPlanLogic _planLogic; private readonly IReinforcedLogic _reinforcedLogic; private readonly IStageLogic _stageLogic; public ReadController(IMasterLogic masterLogic, IComponentLogic componentLogic, IEngenierLogic engenierLogic, ILatheBusyLogic latheBusyLogic, ILatheLogic latheLogic, IPlanLogic planLogic, IReinforcedLogic reinforced, IStageLogic stageLogic, ILogger logger) { _logger = logger; _masterLogic = masterLogic; _componentLogic = componentLogic; _engenierLogic = engenierLogic; _latheBusyLogic = latheBusyLogic; _latheLogic = latheLogic; _planLogic = planLogic; _reinforcedLogic = reinforced; _stageLogic = stageLogic; } [HttpGet] public List getMasters() { try { return _masterLogic.ReadList(null); } catch (Exception ex){ _logger.LogError(ex, "Ошибка регистрации"); throw; } } [HttpGet] public List getComponents() { try { return _componentLogic.ReadList(null); } catch (Exception ex) { _logger.LogError(ex, "Ошибка регистрации"); throw; } } [HttpGet] public List getEngeniers() { try { return _engenierLogic.ReadList(null); } catch (Exception ex) { _logger.LogError(ex, "Ошибка регистрации"); throw; } } [HttpGet] public List getLatheBusies() { try { return _latheBusyLogic.ReadList(null); } catch (Exception ex) { _logger.LogError(ex, "Ошибка регистрации"); throw; } } [HttpGet] public List getLathes() { try { return _latheLogic.ReadList(null); } catch (Exception ex) { _logger.LogError(ex, "Ошибка регистрации"); throw; } } [HttpGet] public List getPlans() { try { return _planLogic.ReadList(null); } catch (Exception ex) { _logger.LogError(ex, "Ошибка регистрации"); throw; } } [HttpGet] public List getReinforcedes() { try { return _reinforcedLogic.ReadList(null); } catch (Exception ex) { _logger.LogError(ex, "Ошибка регистрации"); throw; } } } }