public async Task <IActionResult> Edit(Guid id, [Bind("UserName,Email,Password,AccessPermission,UserId")] User user) { if (id != user.UserId) { return(NotFound()); } if (ModelState.IsValid) { try { _context.Update(user); await _context.SaveChangesAsync(); } catch (DbUpdateConcurrencyException) { if (!UserExists(user.UserId)) { return(NotFound()); } else { throw; } } return(RedirectToAction(nameof(Index))); } return(View(user)); }
public async Task <IActionResult> Edit(Guid id, [Bind("Name,PhoneId")] Phone phone) { if (id != phone.PhoneId) { return(NotFound()); } if (ModelState.IsValid) { try { _context.Update(phone); await _context.SaveChangesAsync(); } catch (DbUpdateConcurrencyException) { if (!PhoneExists(phone.PhoneId)) { return(NotFound()); } else { throw; } } return(RedirectToAction(nameof(Index))); } return(View(phone)); }
public async Task <IActionResult> Edit(Guid id, [Bind("UserName,Email,Password,AdminId")] Admin admin) { if (id != admin.AdminId) { return(NotFound()); } if (ModelState.IsValid) { try { _context.Update(admin); await _context.SaveChangesAsync(); } catch (DbUpdateConcurrencyException) { if (!AdminExists(admin.AdminId)) { return(NotFound()); } else { throw; } } return(RedirectToAction(nameof(Index))); } return(View(admin)); }
public T Update(T itemToUpdate) { var entity = dbContext.Update <T>(itemToUpdate); return(entity.Entity); }