コード例 #1
0
 public ActionResult Create(int categoryId)
 {
     var viewModel = new GroupAdminSubcategoryCreateViewModel
     {
         CategoryId = categoryId,
         CategoryName = categoryService.GetCategoryName(categoryId),
         GroupName = categoryService.GetCategoryGroupName(categoryId),
     };
     return View(viewModel);
 }
コード例 #2
0
 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);
 }