public async Task <IActionResult> Edit(Guid id, ForumCategoriesEditModel category) { if (id == null) { return(NotFound()); } var forumCategory = await _context.ForumCategories .SingleOrDefaultAsync(m => m.Id == id); if (forumCategory == null) { return(NotFound()); } if (ModelState.IsValid) { forumCategory.Name = category.Name; _context.Update(forumCategory); await _context.SaveChangesAsync(); return(RedirectToAction("Index", "Forums")); } return(View(forumCategory)); }
// GET: ForumCategories/Edit/5 public async Task <IActionResult> Edit(Guid?id) { if (id == null) { return(NotFound()); } var forumCategory = await _context.ForumCategories.SingleOrDefaultAsync(m => m.Id == id); if (forumCategory == null) { return(NotFound()); } ForumCategoriesEditModel model = new ForumCategoriesEditModel() { Name = forumCategory.Name }; return(View(model)); }