public async Task <ActionResult <EndpointRuleDto> > Update(Guid id, [FromBody] EndpointRuleDto ruleDto)
        {
            var ruleInDb = await _endpointRuleRepository.Find(id);

            _mapper.Map(ruleDto, ruleInDb);
            foreach (var endpointActionEntity in ruleInDb.Actions)
            {
                endpointActionEntity.EndpointRuleEntityId = id;
                UpdateAction(endpointActionEntity);
            }


            await _endpointRuleRepository.UpdateAsync(ruleInDb);

            var updated = await _endpointRuleRepository.GetByIdAsync(id);

            return(Ok(updated.ToEndpointRuleDto(_internalHelper)));
        }
Ejemplo n.º 2
0
        public async Task <EndpointRuleEntity> Get(Guid id)
        {
            var rule = await _endpointRuleRepository.GetByIdAsync(id);

            return(rule);
        }