public async Task <IActionResult> Delete(AdminCategoryEditDeleteViewModel inputModel)
        {
            var categoryId = inputModel.Id;
            var category   =
                await this.categoriesService.GetBaseById(categoryId);

            /* Delete products */
            await this.productsService.DeleteByCategoryIdAsync(categoryId);

            /* Delete category */
            await this.categoriesService.DeleteAsync(category);

            return(this.RedirectToAction("All"));
        }
        public async Task <AdminCategoryEditDeleteViewModel> GetAsync(int?id)
        {
            var category = await this.context.Categories.FindAsync(id);

            if (category == null)
            {
                return(null);
            }

            var model = new AdminCategoryEditDeleteViewModel
            {
                Id   = category.Id,
                Name = category.Name
            };

            return(model);
        }