Пример #1
0
        public PluginProfileErrorCollection ValidateAdd(MashupManagerProfile profile)
        {
            var errors = new PluginProfileErrorCollection();

            ValidateNameNotEmpty(errors);
            ValidateNameContainsOnlyValidChars(errors);
            ValidateNameUniqueness(errors, profile);

            return(errors);
        }
        private void UpdateProfile(MashupManagerProfile managerProfile)
        {
            var addOrUpdateProfileCommand = ObjectFactory.GetInstance <AddOrUpdateProfileCommand>();
            var profileDto = new PluginProfileDto
            {
                Name     = ProfileName,
                Settings = managerProfile
            };

            addOrUpdateProfileCommand.Execute(profileDto.Serialize());
        }
Пример #3
0
        protected void ValidateNameUniqueness(PluginProfileErrorCollection errors, MashupManagerProfile profile)
        {
            if (errors.Any())
            {
                return;
            }

            var existsSuchName = profile != null && profile.MashupNames
                                 .Any(
                m => m.Equals(Name, StringComparison.InvariantCultureIgnoreCase));

            if (existsSuchName)
            {
                errors.Add(new PluginProfileError
                {
                    FieldName = NameField,
                    Message   = "Mashup with the same name already exists"
                });
            }
        }