コード例 #1
0
        public void AcceptUserOnProject(User user, Project project, String rolename)
        {
            UserProjectSignupRepository signUpRepo = new UserProjectSignupRepository();

            Role acceptedRole = new RoleRepository().GetAll().Where(p => p.RoleName == rolename).SingleOrDefault();

            UserProjectSignup request = signUpRepo.GetAll()
                .Where(p => p.UserId == user.Id && p.ProjectId == project.Id).SingleOrDefault();

            new ProjectRoleRepository().Create
                (new ProjectRole { UserId = request.UserId, ProjectId = request.ProjectId, RoleId = acceptedRole.Id });

            signUpRepo.Delete(request);
        }
コード例 #2
0
        public void RequestProjectAssignment(String code, User user, Role role)
        {
            Project proj = new ProjectRepository().GetAll().Where(p => p.Code == code).SingleOrDefault();

            if (proj == null)
                throw new FaultException("A project with this code does not exist.");

            var existingRequest = new UserProjectSignupRepository().GetAll().Where(
                p => p.ProjectId == proj.Id && p.UserId == user.Id).SingleOrDefault();

            if (existingRequest != null)
            {
                new UserProjectSignupRepository().Delete(existingRequest);
            }

            UserProjectSignup ass = new UserProjectSignup { ProjectId = proj.Id, UserId = user.Id, RoleId = role.Id };

            new UserProjectSignupRepository().Create(ass);
        }
コード例 #3
0
        public void RejectUserFromProject(User user, Project project)
        {
            UserProjectSignupRepository signUpRepo = new UserProjectSignupRepository();

            UserProjectSignup request = signUpRepo.GetAll()
                .Where(p => p.UserId == user.Id && p.ProjectId == project.Id).SingleOrDefault();

            signUpRepo.Delete(request);
        }