public IActionResult AddSubcategory() { var subcategoryInputModel = new SubcategoryInputModel(); subcategoryInputModel.Categories = this.categoryService.GetCategories <GetCategoriesViewModel>(); return(this.View(subcategoryInputModel)); }
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")); }