Пример #1
0
 public IActionResult UpdateBug(BugDetailModel model, int Id)
 {
     if (ModelState.IsValid && model != null)
     {
         string trimmedMsg = "";
         if (model.UpdateDetail.UpdateToLog != null)
         {
             trimmedMsg = model.UpdateDetail.UpdateToLog.Trim();
         }
         _bugs.Update(Id, trimmedMsg, model.UpdateDetail.NewStatus, model.UpdateDetail.AssignedTo, model.UpdateDetail.Project);
     }
     return(LocalRedirect("/Bug/Detail/" + Id));
 }
Пример #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));
        }