Пример #1
0
        public BusinessResponse <long> Insert(UnitGroupApiModel model)
        {
            var result = _validator.Validate(model, options => options.IncludeRuleSets(string.Join(",", Enum.GetName(typeof(UnitGroupRuleSet), UnitGroupRuleSet.Create))));

            if (!result.IsValid || result.Errors.Any())
            {
                return(BusinessResponse <long> .GenerateError(result));
            }

            return(BusinessResponse <long>
                   .GenerateOk(_unitGroupDataAccess.Insert(_mapper.Map <UnitGroup>(model))));
        }