public async Task GetEditModelAsync_WithCategoryId_ShouldReturnValidServiceModel()
        {
            // Arrange
            FitStoreDbContext database = this.Database;

            DatabaseHelper.SeedData(database);

            IManagerCategoryService managerCategoryService = new ManagerCategoryService(database);

            // Act
            CategoryBasicServiceModel result = await managerCategoryService.GetEditModelAsync(firstNotDeletedCategoryId);

            // Assert
            result.Id.Should().Be(firstNotDeletedCategoryId);
            result.Name.Should().Be(firstNotDeletedCategoryName);
        }
        public async Task <IActionResult> Edit(int id)
        {
            bool isCategoryExistingById = await this.categoryService.IsCategoryExistingById(id, false);

            if (!isCategoryExistingById)
            {
                TempData.AddErrorMessage(string.Format(EntityNotFound, CategoryEntity));

                return(this.RedirectToCategoriesIndex(false));
            }

            CategoryBasicServiceModel category = await this.managerCategoryService.GetEditModelAsync(id);

            CategoryFormViewModel model = Mapper.Map <CategoryFormViewModel>(category);

            return(View(model));
        }