public async Task <IActionResult> Edit(int id, [Bind("UserId,FirstName,LastName,Email,Username,Password,Role")] UserAccount userAccount) { if (id != userAccount.UserId) { return(NotFound()); } if (ModelState.IsValid) { try { _context.Update(userAccount); await _context.SaveChangesAsync(); } catch (DbUpdateConcurrencyException) { if (!UserAccountExists(userAccount.UserId)) { return(NotFound()); } else { throw; } } return(RedirectToAction(nameof(Index))); } return(View(userAccount)); }
public async Task <IActionResult> Edit(int id, [Bind("ContentId,ContentHeader,ContentBody,Category,Username")] Content content) { if (id != content.ContentId) { return(NotFound()); } if (ModelState.IsValid) { try { _context.Update(content); await _context.SaveChangesAsync(); } catch (DbUpdateConcurrencyException) { if (!ContentExists(content.ContentId)) { return(NotFound()); } else { throw; } } return(RedirectToAction(nameof(Index))); } return(View(content)); }