Пример #1
0
        public IHttpActionResult AddDeveloperToProject(int projectId, int developerId, [FromBody] string role)
        {
            if (!ModelState.IsValid)
            {
                return(BadRequest(ModelState));
            }

            User.AssertResourceOwnerOrAdmin(developerId);
            try
            {
                _projectProvider.GetProject(projectId);
                _userManager.GetUser(developerId);
            }
            catch (ProjectNotFoundException)
            {
                return(NotFound());
            }
            catch (AccountNotFoundException)
            {
                return(NotFound());
            }

            try
            {
                _projectProvider.AddUserToProject(projectId, developerId, role);
            }
            catch (InvalidOperationException)
            {
                return(Conflict());
            }

            return(Ok());
        }
Пример #2
0
        public ActionResult AddTeam(int projectId)
        {
            var scrumMasters           = _scrumMasterProvider.GetAll();
            var specializations        = _specializationProvider.GetAll();
            var project                = _projectProvider.GetProject(projectId);
            var inputDataTeamViewModel = _groupMapper.ToFormDataAddProjectViewModel(specializations, scrumMasters);

            inputDataTeamViewModel.Project  = _projectMapper.ToViewModel(project);
            inputDataTeamViewModel.FormType = ManagerFormType.AddTeam;

            return(PartialView("_PartialProjectEditorForm", inputDataTeamViewModel));
        }
Пример #3
0
        public ActionResult View(int id)
        {
            var project = _projectProvider.GetProject(id);

            if (project.Status != ProjectStatus.InProgress)
            {
                return(new HttpNotFoundResult());
            }

            project.Groups = project.Groups.Where(g => g.HasScrumMaster)
                             .OrderBy(g => g.StartDate)
                             .ToList();

            foreach (var group in project.Groups)
            {
                group.Trainees = group.Trainees
                                 .OrderBy(t => t.Specialization, new SpecializationComparer())
                                 .ToList();
            }

            var isCurrentUserOwner = CurrentUser.HasRole(RoleType.ScrumMaster) ?
                                     project.IsScrumMasterOwner(CurrentUser.Id.Value) :
                                     false;

            var viewModel = _projectMapper.ToProjectDescriptionViewModel(project, isCurrentUserOwner);

            return(View(viewModel));
        }