Exemplo n.º 1
0
        public IActionResult AddSubcategory()
        {
            var subcategoryInputModel = new SubcategoryInputModel();

            subcategoryInputModel.Categories = this.categoryService.GetCategories <GetCategoriesViewModel>();

            return(this.View(subcategoryInputModel));
        }
Exemplo n.º 2
0
        public async Task <IActionResult> AddSubcategory(SubcategoryInputModel subcategoryInputModel)
        {
            if (!this.ModelState.IsValid)
            {
                return(this.View(subcategoryInputModel));
            }

            await this.subcategoriesService.AddSubcategoryAsync(
                subcategoryInputModel.Name,
                subcategoryInputModel.Description,
                subcategoryInputModel.Image,
                subcategoryInputModel.CategoryId);

            return(this.RedirectToAction("Index", "Home"));
        }