public async Task <IActionResult> AddProjectBug([BindRequired] long?projectId)
        {
            if (!ModelState.IsValid)
            {
                return(RedirectToAction(nameof(Details), new { projectId = projectId.Value }));
            }

            var readProjectRequest = new ReadProjectRequest
            {
                ProjectId = projectId.Value
            };
            var foundProject = await _projectApplicationService.Handle(readProjectRequest);

            var readAvailableTagsRequest = new ReadTagsRequest();
            var availableTags            = await _tagApplicationService.Handle(readAvailableTagsRequest);

            var viewModel = new AddProjectBugViewModel
            {
                ProjectId   = projectId,
                TeamMembers = foundProject.TeamMembers
                              .Select(user => new SelectListItem {
                    Value = user.Id.ToString(), Text = user.FullName
                })
                              .ToList(),
                AvailableTags = availableTags
                                .Select(tag => new SelectListItem {
                    Value = tag.Id.ToString(), Text = tag.Name,
                })
                                .ToList()
            };

            return(View(viewModel));
        }
        public async Task <IActionResult> AddProjectBug([FromForm, Bind("ProjectId,Priority,Title,DueDate,Description,Assignee,SelectedTags")] AddProjectBugViewModel model)
        {
            if (!ModelState.IsValid)
            {
                var readProjectRequest = new ReadProjectRequest
                {
                    ProjectId = model.ProjectId.Value
                };
                var foundProject = await _projectApplicationService.Handle(readProjectRequest);

                var readAvailableTagsRequest = new ReadTagsRequest();
                var availableTags            = await _tagApplicationService.Handle(readAvailableTagsRequest);

                model.TeamMembers = foundProject.TeamMembers
                                    .Select(user => new SelectListItem {
                    Value = user.Id.ToString(), Text = user.FullName
                })
                                    .ToList();
                model.AvailableTags = availableTags
                                      .Select(tag => new SelectListItem {
                    Value = tag.Id.ToString(), Text = tag.Name
                })
                                      .ToList();

                return(View(model));
            }

            var addProjectBugRequest = new AddProjectBugRequest
            {
                ProjectId   = model.ProjectId.Value,
                Priority    = model.Priority,
                Title       = model.Title,
                DueDate     = model.DueDate.Value,
                Description = model.Description,
                Assignee    = model.Assignee.Value,
                Tags        = model.SelectedTags
            };
            await _projectApplicationService.Handle(addProjectBugRequest);

            return(RedirectToAction(nameof(Details), new { projectId = model.ProjectId.Value }));
        }