public async Task <IActionResult> Edit(string id, [Bind("PagePath,Description")] DemoDescription demoDescription) { if (string.IsNullOrWhiteSpace(id) || id.ToLower() != demoDescription.PagePath.TrimStart('/').ToLower()) { return(NotFound()); } if (ModelState.IsValid) { try { _context.Update(demoDescription); await _context.SaveChangesAsync(); } catch (DbUpdateConcurrencyException) { if (!DemoDescriptionExists(demoDescription.PagePath)) { return(NotFound()); } else { throw; } } return(RedirectToAction(nameof(Index))); } return(View(demoDescription)); }
public async Task <IActionResult> Create([Bind("PagePath,Description")] DemoDescription demoDescription) { if (ModelState.IsValid) { _context.Add(demoDescription); await _context.SaveChangesAsync(); return(RedirectToAction(nameof(Index))); } return(View(demoDescription)); }