public ActionResult Create(int categoryId) { var viewModel = new GroupAdminSubcategoryCreateViewModel { CategoryId = categoryId, CategoryName = categoryService.GetCategoryName(categoryId), GroupName = categoryService.GetCategoryGroupName(categoryId), }; return View(viewModel); }
public ActionResult Create(GroupAdminSubcategoryCreateViewModel viewModel) { if (ModelState.IsValid) { var subcategory = new Subcategory { Name = viewModel.Name, CategoryId = viewModel.CategoryId, }; subcategoryService.CreateSubcategory(subcategory); return Redirect("/GroupAdmin/Group"); } return View(viewModel); }