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