public async Task <IActionResult> AddUserToProject(int projectId) { if (!IsCurrentUserInProject(projectId)) { return(Unauthorized()); } var AddUserToProjectInputModel = new AddUserToProjectInputModel { UsersDropdown = this.mapper.Map <ICollection <UsersDropdown> >(await this.projectsService.GetUsersDropDown(projectId)), }; return(View(AddUserToProjectInputModel)); }
public async Task <IActionResult> AddUserToProject(AddUserToProjectInputModel inputModel, int projectId) { if (!IsCurrentUserInProject(projectId)) { return(Unauthorized()); } if (!ModelState.IsValid) { var AddUserToProjectInputModel = new AddUserToProjectInputModel { UsersDropdown = this.mapper.Map <ICollection <UsersDropdown> >(await this.projectsService.GetUsersDropDown(projectId)), }; } await this.projectsService.AddUserToProject(inputModel.UserId, projectId); return(RedirectToAction(nameof(Get), new { projectId = projectId })); }