Ejemplo n.º 1
0
        public async Task <IActionResult> ManageProjectsAsync()
        {
            var allProjects = _bug.GetAllProjects();
            var currentUser = await _userManager.FindByNameAsync(User.Identity.Name)
                              .ConfigureAwait(false);

            var allUsers = await _userBug.GetAllTeamMembersAsync(currentUser)
                           .ConfigureAwait(false);

            var userProjects = await _userBug.GetGetAllUserProjectsByUserAsync(currentUser)
                               .ConfigureAwait(false);

            var allTeams = await _userBug.GetAllTeamsByUser(currentUser)
                           .ConfigureAwait(false);

            var assignedListingModel = userProjects
                                       .Select(result => new AssignedProjectListingModel
            {
                FullName     = result.User.FirstName + " " + result.User.LastName,
                Username     = result.User.UserName,
                EmailAddress = result.User.Email,
                Project      = result.Project.Name
            });
            var listingModel = allProjects
                               .Select(result => new ProjectListingModel
            {
                Project = result.Name,
                Manager = (_userBug.GetManagerAsync(result.Owner).Result)?.UserName,
                Team    = result.Owner?.Name,
                Email   = (_userBug.GetManagerAsync(result.Owner).Result)?.Email
            });
            // list anyone that is not just a submitter
            var model = new ProjectIndexModel
            {
                UserProjects = assignedListingModel,
                TeamProjects = listingModel,
                Projects     = (await _userBug.GetAllProjectByUserAsync(currentUser)
                                .ConfigureAwait(false)).Select(proj => proj.Name),
                Users = allUsers.Select(user => user.UserName),
                Teams = allTeams.Select(team => team.Name)
            };

            return(View(model));
        }
Ejemplo n.º 2
0
        public async Task <IActionResult> DetailAsync(int id)
        {
            var bug               = _bugs.GetById(id);
            var detail            = bug.LogDetail == null ? "" : bug.LogDetail.Detail;
            var createdByFullName = bug.CreatedBy.FirstName + " " + bug.CreatedBy.LastName + " @";
            var closedByFullName  = "";
            var currentUser       = await _userManager.FindByNameAsync(User.Identity.Name).ConfigureAwait(false);

            if (bug.ClosedBy != null)
            {
                closedByFullName = bug.ClosedBy.FirstName + " " + bug.ClosedBy.LastName + " @";
            }
            var model = new BugDetailModel()
            {
                Id               = id,
                Title            = bug.Title,
                ProgressLog      = detail,
                Project          = bug.ProjectAffected?.Name,
                AssignedTo       = bug.AssignedTo?.UserName,
                Status           = bug.Status?.Name,
                Team             = bug.Owner?.Name,
                Description      = bug.Description,
                Urgency          = bug.Urgency?.Level,
                CreatedOn        = bug.CreatedOn,
                CreatedBy        = createdByFullName + bug.CreatedBy.UserName,
                ClosedOn         = bug.ClosedOn,
                ClosedBy         = bug.ClosedBy == null ? null : closedByFullName + bug.ClosedBy.UserName,
                StatusOptions    = _bugs.GetAllStatus().Select(status => status.Name),
                DeveloperOptions = (await _userBug.GetAllTeamMembersAsync(currentUser).ConfigureAwait(false))
                                   .Select(u => u.UserName),
                ProjectOptions = (await _userBug.GetAllProjectByUserAsync(currentUser).ConfigureAwait(false))
                                 .Select(proj => proj.Name),
                UserProjectOptions = _userBug.GetAllUserProjectsByUser(currentUser).Select(result => new UserProjectModel
                {
                    Username = result.User.UserName,
                    Project  = result.Project.Name
                }),

                UpdateDetail = new BugUpdateModel()
            };

            return(View(model));
        }
Ejemplo n.º 3
0
        public async Task <IActionResult> IndexAsync()
        {
            SubmissionOptionsModel options = null;
            var currentUser = await _userManager.FindByNameAsync(User.Identity.Name)
                              .ConfigureAwait(false);

            if (User.IsInRole("Admin"))
            {
                options = new SubmissionOptionsModel()
                {
                    ProjectOptions = _bug.GetAllProjects().Select(proj => proj.Name),
                    TeamOptions    = _bug.GetAllTeams().Select(team => team.Name),
                    UrgencyOptions = _bug.GetAllUrgencies().Select(urgency => urgency.Level)
                };
            }
            else if (User.IsInRole("Manager"))
            {
                options = new SubmissionOptionsModel()
                {
                    ProjectOptions = (await _userBug.GetAllProjectByUserAsync(currentUser)
                                      .ConfigureAwait(false))
                                     .Select(proj => proj.Name),
                    UserProjectOptions = _userBug.GetAllUserProjectsByUser(currentUser)
                                         .Select(result => new UserProjectModel
                    {
                        Username = result.User.UserName,
                        Project  = result.Project.Name
                    }),
                    UrgencyOptions = _bug.GetAllUrgencies().Select(urgency => urgency.Level)
                };
            }

            var model = new SubmissionIndexModel()
            {
                Options = options
            };

            return(View(model));
        }
Ejemplo n.º 4
0
        public async Task <IActionResult> IndexAsync()
        {
            var currentUser = await _userManager.FindByNameAsync(User.Identity.Name)
                              .ConfigureAwait(false);

            var projectsByUser = await _userBug.GetAllProjectByUserAsync(currentUser)
                                 .ConfigureAwait(false);

            var listingModel = projectsByUser.Select(proj => new ProjectListingModel
            {
                Name       = proj.Name,
                Team       = proj.Owner.Name,
                AssignedTo = _userBug.GetUserByProject(proj).UserName,
                Id         = proj.Id
            });

            var model = new ProjectIndexModel
            {
                ListingModel = listingModel
            };

            return(View(model));
        }