public ActionResult AddNewCategory(AddNewCategoryViewModel model) { adminService.AddNewCategory(new Category() { CategoryName = model.CategoryName, GroupId = model.AssignedToGroupId, IsAssemblyCategory = model.IsAssembly, IsRequiredToAssembly = model.IsRequired }); return(RedirectToAction(nameof(CategoriesPanel))); }
public IActionResult AddNewCategory(AddNewCategoryViewModel model) { if (ModelState.IsValid) { LocationCategory category = new LocationCategory { Title = model.Title }; categoryRepository.Insert(category); categoryRepository.Save(); TempData["created_category"] = $"New Location Category { model.Title }, was created successfully."; return(Redirect("allcategories")); } return(View(model)); }