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))); }
public async Task <EndpointRuleEntity> Get(Guid id) { var rule = await _endpointRuleRepository.GetByIdAsync(id); return(rule); }