public async Task <IActionResult> Edit(int id, [Bind("id,Name,GroupId")] GroupMember groupMember) { if (id != groupMember.id) { return(NotFound()); } if (ModelState.IsValid) { try { await _groupMember.UpdateGroupMember(groupMember); } catch (DbUpdateConcurrencyException) { if (!GroupMemberExists(groupMember.id)) { return(NotFound()); } else { throw; } } return(RedirectToAction(nameof(Index))); } ViewData["GroupId"] = new SelectList(_context.Groups, "id", "Name", groupMember.GroupId); return(View(groupMember)); }