示例#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));
        }
示例#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));
        }