public async Task <IActionResult> Edit(long id, [Bind("CategoryId,Title,Description")] Category category) { if (id != category.CategoryId) { return(NotFound()); } if (ModelState.IsValid) { try { _context.Update(category); await _context.SaveChangesAsync(); } catch (DbUpdateConcurrencyException) { if (!CategoryExists(category.CategoryId)) { return(NotFound()); } else { throw; } } return(RedirectToAction(nameof(Index))); } return(View(category)); }
public async Task <IActionResult> Edit([Bind("CourseId,Title,Author,Source,CategoryId,Description,Posted")] Course course) { if (ModelState.IsValid) { try { _context.Update(course); await _context.SaveChangesAsync(); } catch (DbUpdateConcurrencyException) { if (!CourseExists(course.CourseId)) { return(NotFound()); } else { throw; } } } return(RedirectToAction(nameof(Index), new { id = course.CategoryId })); }