public int CreateNewCategory(CategoryInputModel category) { var slug = category.Name.ToLower().Replace(" ", "-"); Console.WriteLine(slug); category.Slug = slug; return(_categoryRepository.CreateNewCategory(category)); }
public void SaveCategoryTestContext() { Category C = new Category("Testcategory", 1); C.CategoryDesc = "Testcategorydesc"; C.CategoryImg = "NoImage.jpg"; CatRepoTest.CreateNewCategory(C); var TotalCategories = CatRepoTest.RetrieveAllCategories(); Assert.IsTrue(TotalCategories.Count > 4); }
public ActionResult Add(CategoryViewModel model, string uploadedImage) { var c = new Category(model.CategoryName, 1); c.CategoryDesc = model.CategoryDesc; if (c.CategoryDesc == null) { c.CategoryDesc = "No description"; } c.CategoryImg = uploadedImage; if (categoryRep.CreateNewCategory(c)) { return(RedirectToAction("Overview", "Category")); } return(RedirectToAction("Overview", "Category")); }
public CategoryDto CreateNewCategory(CategoryInputModel category) { return(_categoryRepository.CreateNewCategory(category)); }