public async Task <IActionResult> Edit(int id, [Bind("Id,Type")] Role role) { if (id != role.Id) { return(NotFound()); } if (ModelState.IsValid) { try { _context.Update(role); await _context.SaveChangesAsync(); } catch (DbUpdateConcurrencyException) { if (!RoleExists(role.Id)) { return(NotFound()); } else { throw; } } return(RedirectToAction(nameof(Index))); } return(View(role)); }
public async Task <bool> UpdateAsync(User user) { user.Password = MD5Hash(user.Password); _dbContext.Update(user); await _dbContext.SaveChangesAsync(); return(true); }