Пример #1
0
        public IActionResult EnableAgentById([FromRoute] int agentId)
        {
            AgentModel agent = _repository.GetById(agentId);

            agent.Status = true;
            _repository.Update(agent);

            _logger.LogInformation($"Подключение агента {agentId}");

            return(Ok());
        }
Пример #2
0
        public IActionResult EnableAgentById([FromRoute] int agentId)
        {
            _logger.LogInformation($"Включение агента {agentId}");

            var agent = _repository.GetById(agentId);

            if (agent == null)
            {
                return(NotFound());
            }

            if (!agent.Active)
            {
                agent.Active = true;
                _repository.Update(agent);
            }

            return(Ok());
        }
Пример #3
0
        public IAgentModel Get(int id)
        {
            var agent = _repo.GetById(id);

            return(_mapper.Map <AgentModel>(agent));
        }