public async Task <IActionResult> Create([Bind("UserName,Password,FirstName,LastName,TeamId,Id")] User user) { if (ModelState.IsValid) { _context.Add(user); await _context.SaveChangesAsync(); return(RedirectToAction(nameof(Index))); } ViewData["TeamId"] = new SelectList(_context.Teams, "Name", "Id", user.TeamId); return(View(user)); }
public async Task <IActionResult> Create([Bind("Name,ProjectId,TeamLeaderId,Id")] Team team) { if (ModelState.IsValid) { _context.Add(team); await _context.SaveChangesAsync(); 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)); }