Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- <button class="button" data-open="categoryModal">Create A Group</button>
- <div class="reveal" id="categoryModal" data-reveal>
- <h1>Create Category</h1>
- @using (Html.BeginForm("CreateCategory", "Home"))
- {
- <input type="text" name="categoryName" />
- <input type="submit" class="button"/>
- }
- </div>
- [HttpPost]
- public IActionResult CreateCategory(CategoryVM category)
- {
- if(!ModelState.IsValid) return View(category);
- if (//category already exists)
- {
- ModelState.AddModelError("", "Category exists");
- return View(category);
- }
- _categoryRepository.Insert(new Category { Name = category.Name });
- return RedirectToAction("Index", "Home");
- }
Add Comment
Please, Sign In to add comment