public async Task <IActionResult> Edit(int id, [Bind("UserName,Password,FirstName,LastName,TeamId,Id")] 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))); } ViewData["TeamId"] = new SelectList(_context.Teams, "Id", "Id", user.TeamId); return(View(user)); }
public async Task <IActionResult> Edit(int id, [Bind("Name,ProjectId,TeamLeaderId,Id")] Team team) { if (id != team.Id) { return(NotFound()); } if (ModelState.IsValid) { try { _context.Update(team); await _context.SaveChangesAsync(); } catch (DbUpdateConcurrencyException) { if (!TeamExists(team.Id)) { return(NotFound()); } else { throw; } } return(RedirectToAction(nameof(Index))); } ViewData["ProjectId"] = new SelectList(_context.Projects, "Id", "Name", team.ProjectId); ViewData["TeamLeaderId"] = new SelectList(_context.Users, "Id", "FirstName", team.TeamLeaderId); return(View(team)); }