public UserProjectSignup Update(UserProjectSignup projRole)
        {
            using (var ctx = new WcfEntityContext())
            {
                ctx.AttachModify("UserProjectSignups", projRole);

                return projRole;
            }
        }
Esempio n. 2
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);
        }
Esempio n. 3
0
        public UserProjectSignup Update(UserProjectSignup projRole)
        {
            using (var ctx = new WcfEntityContext())
            {
                ctx.AttachModify("UserProjectSignups", projRole);

                return(projRole);
            }
        }
        public UserProjectSignup Create(UserProjectSignup projSignup)
        {
            using (var ctx = new WcfEntityContext())
            {
                ctx.UserProjectSignup.AddObject(projSignup);

                ctx.SaveChanges();

                return projSignup;
            }
        }
Esempio n. 5
0
        public UserProjectSignup Create(UserProjectSignup projSignup)
        {
            using (var ctx = new WcfEntityContext())
            {
                ctx.UserProjectSignup.AddObject(projSignup);

                ctx.SaveChanges();

                return(projSignup);
            }
        }
        public void Delete(UserProjectSignup projRole)
        {
            using (var ctx = new WcfEntityContext())
            {
                var entityToDelete = ctx.UserProjectSignup.Where(p => p.ProjectId == projRole.ProjectId
                                                           && p.UserId == projRole.UserId
                                                           && p.RoleId == projRole.RoleId).SingleOrDefault();

                ctx.UserProjectSignup.DeleteObject(entityToDelete);
                ctx.SaveChanges();
            }
        }
Esempio n. 7
0
        public void Delete(UserProjectSignup projRole)
        {
            using (var ctx = new WcfEntityContext())
            {
                var entityToDelete = ctx.UserProjectSignup.Where(p => p.ProjectId == projRole.ProjectId &&
                                                                 p.UserId == projRole.UserId &&
                                                                 p.RoleId == projRole.RoleId).SingleOrDefault();

                ctx.UserProjectSignup.DeleteObject(entityToDelete);
                ctx.SaveChanges();
            }
        }
Esempio n. 8
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);
        }
Esempio n. 9
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);
        }
Esempio n. 10
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);
        }