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); }
/// <summary> /// Creates subcategory /// </summary> /// <param name="subcategory">The subcategory to be created</param> public void CreateSubcategory(Subcategory subcategory) { subcategoryRepo.Add(subcategory); subcategoryRepo.Save(); }