public void CreateCategory(CategoryOfPost newCategory) { using (SqlConnection cn = new SqlConnection(Settings.ConnectionString)) { cn.Query <CategoryOfPost>("insert into CategoryOfPost(CategoryType, CategoryDescription) Values (@catType, @catDesc)", new { catType = newCategory.CategoryType, catDesc = newCategory.CategoryDescription }); } }
public ActionResult CreateCategory(CategoryOfPost newCategory) { var ops = OperationsFactory.CreateCategoryOps(); ops.CreateCategory(newCategory); return RedirectToAction("Index","DraftPost"); }
public void CreateCategory(CategoryOfPost newCategory) { using (SqlConnection cn = new SqlConnection(Settings.ConnectionString)) { cn.Query<CategoryOfPost>("insert into CategoryOfPost(CategoryType, CategoryDescription) Values (@catType, @catDesc)", new { catType = newCategory.CategoryType, catDesc = newCategory.CategoryDescription }); } }
public void CreateCategory(CategoryOfPost category) { if (!string.IsNullOrEmpty(category.CategoryType)) { _repo.CreateCategory(category); } }
public ActionResult CreateCategory(CategoryOfPost newCategory) { var ops = OperationsFactory.CreateCategoryOps(); ops.CreateCategory(newCategory); return(RedirectToAction("Index", "DraftPost")); }
public async Task <IEnumerable <T> > GetByCategoryAsync <T>(CategoryOfPost categoryName, int take, int skip = 0) => await this.repository.All() .Where(x => x.Category == categoryName) .OrderByDescending(x => x.CreatedOn) .Skip(skip) .Take(take) .To <T>() .ToListAsync();
public void CreateCategoryDbEmptyTypeTest() { var ops = OperationsFactory.CreateCategoryOps(); var category = new CategoryOfPost() { CategoryDescription = "Hello world" }; ops.CreateCategory(category); var list = ops.ListAllCategories(); Assert.AreEqual(1,list.Count); }
public void CreateNewCategoryDb() { var repo = new CategoryOfPostsRepo(); var category = new CategoryOfPost() { CategoryType = "Technology Trends", CategoryDescription = "Trends in tech" }; repo.CreateCategory(category); var list = repo.ListAllCategories(); Assert.AreEqual(1,list.Count); }
public void CreateCategoryDbEmptyTypeTest() { var ops = OperationsFactory.CreateCategoryOps(); var category = new CategoryOfPost() { CategoryDescription = "Hello world" }; ops.CreateCategory(category); var list = ops.ListAllCategories(); Assert.AreEqual(1, list.Count); }
public void CreateNewCategoryDb() { var repo = new CategoryOfPostsRepo(); var category = new CategoryOfPost() { CategoryType = "Technology Trends", CategoryDescription = "Trends in tech" }; repo.CreateCategory(category); var list = repo.ListAllCategories(); Assert.AreEqual(1, list.Count); }
public void CreateCategory(CategoryOfPost category) { }
public void CreateCategory(CategoryOfPost category) { }
public async Task <int> GetCountByCategoryAsync(CategoryOfPost categoryName) => await this.repository.All() .Where(x => x.Category == categoryName) .CountAsync();