public static Enumerations.TeamRole FindTeamRoleOfMemberProject(int memberId, int projectId) { using (var dc = new DataContext()) { Enumerations.TeamRole r = dc.Projects.Where(x => x.ProjectId == projectId).Select(x => x.Team).First() .TeamMembers.Where(x => x.MemberId == memberId).Select(x => x.TeamRole).First(); return(r); } }
public static MemberProjectDTO CreateMemberTeamProjectDTO(Member member, Project project) { Enumerations.TeamRole r = Teams.FindTeamRoleOfMemberProject(member.MemberId, project.ProjectId); return(new MemberProjectDTO { MemberId = member.MemberId, ProjectId = project.ProjectId, ProjectName = project.Name, ProjectWebsite = project.Website, TeamName = project.Team.Name, TeamRole = r }); }
public static void AddMemberToTeam(int memberId, int teamId, Enumerations.TeamRole role) { using (var dc = new DataContext()) { MemberTeam mt = new MemberTeam { MemberId = memberId, TeamId = teamId, TeamRole = role }; dc.MemberTeams.Add(mt); dc.SaveChanges(); } }