Exemple #1
0
        public IActionResult EnableAgentById([FromRoute] int agentId)
        {
            AgentModel agent = _repository.GetById(agentId);

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

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

            return(Ok());
        }
        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());
        }
Exemple #3
0
        public bool Update(IAgentModel model)
        {
            var agent = _mapper.Map <Agent>(model);

            return(_repo.Update(agent));
        }