Пример #1
0
        public string CreateSubCategory(SubCategory subCategory)
        {
            CheckHelper.ArgumentNotNull(subCategory, "subCategory");
            CheckHelper.WithinCondition(SecurityService.IsLoggedIn, "SecurityService.IsLoggedIn");

            var errors = IoC.Container.Get <IValidateService>().Validate(subCategory);

            if (errors != null)
            {
                return(errors.ToErrorMessage());
            }

            var createdSubCategory = (SubCategory)subCategory.Clone();

            var errorMessage = APIClientHelper <DictionaryAPIClient> .Call(c => c.CreateSubCategory(ref createdSubCategory));

            subCategory.Id = createdSubCategory.Id;

            return(errorMessage);
        }