コード例 #1
0
        public OperationResult Create(CreateProductCategory command)
        {
            var operation = new OperationResult();

            if (_productCategoryRepository.Exsists(x => x.Name == command.Name))
            {
                return(operation.Failed(ApplicationMessages.DuplicatedRecord));
            }

            var slug            = command.Slug.Slugify();
            var productCategory = new ProductCategory(command.Name, command.Description
                                                      , command.Picture, command.PictureAlt
                                                      , command.PictureTitle, command.Keywords, command.MetaDescription, slug);

            _productCategoryRepository.Create(productCategory);
            _productCategoryRepository.SaveChanges();

            return(operation.Succeded());
        }