public async Task <IActionResult> CreateBlogCategory(BlogCategoryAdminCreateViewModel inputModel)
        {
            if (!this.ModelState.IsValid)
            {
                return(this.View(inputModel));
            }

            await this.categoriesService.CreateBlogCategoryAsync(inputModel);

            return(this.RedirectToAction("Index", "Home"));
        }
        public async Task CreateBlogCategoryAsync(BlogCategoryAdminCreateViewModel inputModel)
        {
            var blogCategory = new BlogCategory
            {
                Name = inputModel.Name,
            };

            await this.dbContext.BlogCategories.AddAsync(blogCategory);

            await this.dbContext.SaveChangesAsync();
        }
        public async Task CreateBlogCategoryAsyncShouldCreateBlogCategorySuccessfully()
        {
            var options = new DbContextOptionsBuilder <MyCalisthenicAppDbContext>()
                          .UseInMemoryDatabase(databaseName: Guid.NewGuid().ToString())
                          .Options;

            var dbContext = new MyCalisthenicAppDbContext(options);

            var categoriesService = new CategoriesService(dbContext, null);

            var categoryInputModel = new BlogCategoryAdminCreateViewModel
            {
                Name = CategoryName,
            };

            await categoriesService.CreateBlogCategoryAsync(categoryInputModel);

            var actual = dbContext.BlogCategories.FirstOrDefaultAsync(bc => bc.Name == CategoryName);

            Assert.Equal(actual.Result.Name, CategoryName);
        }