示例#1
0
        public ArticleMaterialVM ArticleCreate()
        {
            var articleVM = materialHelper.ArticleFullData();

            if (validations.Validate(articleVM).IsValid&& acticleValidator.Validate(articleVM).IsValid)
            {
                var mappedArticle = mapper.Map <ArticleMaterialVM, ArticleMaterial>(articleVM);
                articleMaterialService.AddArticleMaterial(mappedArticle);

                Dye.Succsess();
                Console.WriteLine("You have add article");
                Console.ResetColor();
                return(articleVM);
            }
            else
            {
                Dye.Fail();
                Console.WriteLine(acticleValidator.Validate(articleVM) + " " + " " + validations.Validate(articleVM));
                Console.ResetColor();
                ArticleCreate();
                return(null);
            }
        }