private void CreateTeamWithMember() { var teamMember = new Data.TeamMember() { UserId = "TestUser" }; var team = new Data.Team() { Id = 0 }; team.TeamMembers.Add(teamMember); teamMember.Team = team; _mockContainer.Teams.Add(team); _mockContainer.TeamMembers.Add(teamMember); }
private void CreateTeamAndTeamMember(out Data.Team team, out Data.TeamMember teamMember) { team = new Data.Team() { Id = 1 }; teamMember = new Data.TeamMember() { UserId = TestUser, Id = 1 }; teamMember.Team = team; teamMember.TeamId = team.Id; team.TeamMembers.Add(teamMember); _mockContainer.Teams.Add(team); _mockContainer.TeamMembers.Add(teamMember); }
public void AddUserToTeam(int id, TeamMember member) { Data.TeamMember teamMember = null; var team = _teamRepo.FindById(id); if (team.TeamMembers.Any(i => i.UserId == member.EmailAddress)) { teamMember = team.TeamMembers.Where(i => i.UserId == member.EmailAddress).First(); } else { teamMember = new Data.TeamMember() { UserId = member.EmailAddress }; team.TeamMembers.Add(teamMember); } teamMember.IsAdmin = member.IsAdmin; _teamRepo.SaveChanges(); }