// Create new Subcategory public IActionResult CreateSubcategory(MainPageViewModel vm) { if (vm.AttributeGroupName != null) { var AttrGroupId = attributeGroupRepo.CreateAttributeGroup(vm); productAttributeRepo.CreateProductAttribute(vm, AttrGroupId); var SubCatId = subcategoryRepo.CreateSubcategory(vm); subcategoryAttributeGroupRepo.CreateSubcategoryAttributeGroup(AttrGroupId, SubCatId); } return(RedirectToAction("Index")); }