public async Task <IActionResult> Edit(string id, [Bind("Country,Id,UserName,NormalizedUserName,Email,NormalizedEmail,EmailConfirmed,PasswordHash,SecurityStamp,ConcurrencyStamp,PhoneNumber,PhoneNumberConfirmed,TwoFactorEnabled,LockoutEnd,LockoutEnabled,AccessFailedCount")] User user) { if (id != user.Id) { return(NotFound()); } if (ModelState.IsValid) { try { _context.Update(user); await _context.SaveChangesAsync(); } catch (DbUpdateConcurrencyException) { if (!UserExists(user.Id)) { return(NotFound()); } else { throw; } } return(RedirectToAction(nameof(Index))); } return(View(user)); }
public async Task <IActionResult> Edit(string id, [Bind("ID,Name,Country")] DataCenter dataCenter) { if (id != dataCenter.ID) { return(NotFound()); } if (ModelState.IsValid) { try { _context.Update(dataCenter); await _context.SaveChangesAsync(); } catch (DbUpdateConcurrencyException) { if (!DataCenterExists(dataCenter.ID)) { return(NotFound()); } else { throw; } } return(RedirectToAction(nameof(Index))); } return(View(dataCenter)); }
public async Task <IActionResult> Edit(string id, [Bind("ID,CPU,RAM,UserID,OS,DataCenterID")] Server server) { string username = User.Identity.Name; if (string.IsNullOrEmpty(username)) { return(View("_NotLoggedIn")); } if (id != server.ID) { return(NotFound()); } if (ModelState.IsValid) { try { _context.Update(server); await _context.SaveChangesAsync(); } catch (DbUpdateConcurrencyException) { if (!ServerExists(server.ID)) { return(NotFound()); } else { throw; } } return(RedirectToAction(nameof(Index))); } ViewData["DataCenterID"] = new SelectList(_context.DataCenter, "ID", "Name", server.DataCenterID); ViewData["UserID"] = new SelectList(_context.Users, "Id", "Id", server.UserID); return(View(server)); }