public static void LogEvent(Project project, User user, int actionConst, Bug bug) { var action = new BugActionRepository().GetAll().Where(p => p.Id == actionConst).SingleOrDefault(); var proj = new ProjectRepository().GetAll().Where(p => p.Id == project.Id).SingleOrDefault(); new BugActionLogRepository().Create(new BugActionLog { Project = proj, Action = action, BugName = bug.Name, UserName = user.FirstName.Substring(0, 1) + "." + user.Surname }); }
public Project AddProject(Project project) { ProjectRepository projRepo = new ProjectRepository(); ProjectRoleRepository projRoleRepo = new ProjectRoleRepository(); RoleRepository roleRepo = new RoleRepository(); Project addedProj = projRepo.Create(project); int ManagerId = roleRepo.GetAll().Where(x => x.RoleName == "Project Manager").Select(c => c.Id).SingleOrDefault(); int CurrentUserId = GetMyUser().Id; // Make the user who added the project, a project manager projRoleRepo.Create(new ProjectRole { ProjectId = addedProj.Id, RoleId = ManagerId, UserId = CurrentUserId }); return addedProj; }
public void DeleteProject(Project project) { ProjectRepository projRepo = new ProjectRepository(); projRepo.Delete(project); }
public Project SaveProject(Project project) { ProjectRepository projRepo = new ProjectRepository(); return projRepo.Update(project); }
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); }