public async Task <IActionResult> Edit(int id, [Bind("Id,Name,ActivityType,StartDate,EndDate,Description")] Activity activity) { if (id != activity.Id) { return(NotFound()); } if (ModelState.IsValid) { try { _context.Update(activity); await _context.SaveChangesAsync(); } catch (DbUpdateConcurrencyException) { if (!ActivityExists(activity.Id)) { return(NotFound()); } else { throw; } } return(RedirectToAction(nameof(Index))); } return(View(activity)); }
public async Task <IActionResult> Edit(int id, [Bind("Id,Title,Description,StartDate,EndDate")] Module @module) { if (id != @module.Id) { return(NotFound()); } if (ModelState.IsValid) { try { db.Update(@module); await db.SaveChangesAsync(); } catch (DbUpdateConcurrencyException) { if (!ModuleExists(@module.Id)) { return(NotFound()); } else { throw; } } return(RedirectToAction(nameof(Index))); } return(View(@module)); }
public async Task <IActionResult> Edit(int id, [Bind("Id,Name,Description,UploadTime")] Document document) { if (id != document.Id) { return(NotFound()); } if (ModelState.IsValid) { try { _context.Update(document); await _context.SaveChangesAsync(); } catch (DbUpdateConcurrencyException) { if (!DocumentExists(document.Id)) { return(NotFound()); } else { throw; } } return(RedirectToAction(nameof(Index))); } return(View(document)); }