public ActionResult Create(GroupAdminCategoryCreateViewModel viewModel) { if (ModelState.IsValid) { var category = new Category { Name = viewModel.Name, GroupId = viewModel.GroupId, }; categoryService.CreateCategory(category); return Redirect("/GroupAdmin/Group"); } return View(viewModel); }
/// <summary> /// Creates a category /// </summary> /// <param name="category">The category to be created</param> public void CreateCategory(Category category) { categoryRepo.Add(category); categoryRepo.Save(); }