public OperationResult Create(ProductCategoryCreate create) { var operation = new OperationResult(); if (ProductCategoryRepository.Exists(p => p.Name == create.Name)) { return(operation.Fail(ApplicationMessages.DuplicateRecord)); } var slug = create.Slug.Slugify(); var productCategory = new ProductCategory(create.Name, create.Description, create.Picture, create.PictureAlt, create.PictureTitle, create.Keywords, create.MetaDescription, slug); ProductCategoryRepository.Create(productCategory); ProductCategoryRepository.SaveChanges(); return(operation.Success()); }
public JsonResult OnPostCreate(ProductCategoryCreate create) { var result = _productCategoryApplication.Create(create); return(new JsonResult(result)); }