public ConfigurationModel Create(int businessEntityTypeId, ConfigurationModel configuration)
        {
            var result = _repository.Create(new Configuration {
                Name = configuration.Name
            });

            var ageRanges = configuration.AgeRanges.Select(ar => _ageRangeService.Create(result.Id, ar)).ToList();
            var fields    = configuration.FieldsMappingRules.Select(rule => _fieldsMappingRuleService.Create(businessEntityTypeId, rule)).ToList();

            return(new ConfigurationModel {
                Id = result.Id, Name = result.Name, AgeRanges = ageRanges, FieldsMappingRules = fields
            });
        }
Пример #2
0
 public FieldsMappingRuleModel Post([FromQuery] int businessEntityTypeId, [FromBody] FieldsMappingRuleModel fieldsMappingRule)
 {
     return(_service.Create(businessEntityTypeId, fieldsMappingRule));
 }