示例#1
0
文件: Teams.cs 项目: n-mitic/portal
        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);
            }
        }
示例#2
0
 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
     });
 }
示例#3
0
文件: Members.cs 项目: n-mitic/portal
        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();
            }
        }