public async Task <IActionResult> Get() { if (!ProjectId.HasValue) { return(ErrorResult .BadRequest($"Project Id provided in the url path is invalid. Must be a valid GUID.", ResultErrorCode.ValidationError) .ActionResult()); } var project = await projectsRepository .GetAsync(ProjectId.Value) .ConfigureAwait(false); if (project is null) { return(ErrorResult .NotFound($"A Project with the ID '{ProjectId.Value}' could not be found in this TeamCloud Instance") .ActionResult()); } var users = project?.Users ?? new List <User>(); return(DataResult <List <User> > .Ok(users.ToList()) .ActionResult()); }
public async Task <IActionResult> Get() { if (!ProjectId.HasValue) { return(ErrorResult .BadRequest($"Project Id provided in the url path is invalid. Must be a valid GUID.", ResultErrorCode.ValidationError) .ActionResult()); } var project = await projectsRepository .GetAsync(ProjectId.Value) .ConfigureAwait(false); if (project is null) { return(ErrorResult .NotFound($"A Project with the ID '{ProjectId.Value}' could not be found in this TeamCloud Instance.") .ActionResult()); } var tags = project?.Tags is null ? new Dictionary <string, string>() : new Dictionary <string, string>(project.Tags); return(DataResult <Dictionary <string, string> > .Ok(tags) .ActionResult()); }
public async Task <IActionResult> Get(string projectNameOrId) { if (string.IsNullOrWhiteSpace(projectNameOrId)) { return(ErrorResult .BadRequest($"The identifier '{projectNameOrId}' provided in the url path is invalid. Must be a valid project name or GUID.", ResultErrorCode.ValidationError) .ActionResult()); } Project project; if (Guid.TryParse(projectNameOrId, out var projectId)) { project = await projectsRepository .GetAsync(projectId) .ConfigureAwait(false); } else { project = await projectsRepository .GetAsync(projectNameOrId) .ConfigureAwait(false); } if (project is null) { return(ErrorResult .NotFound($"A Project with the identifier '{projectNameOrId}' could not be found in this TeamCloud Instance") .ActionResult()); } return(DataResult <Project> .Ok(project) .ActionResult()); }
public async Task <IActionResult> Get(Guid projectId) { var project = await projectsRepository .GetAsync(projectId) .ConfigureAwait(false); return(project is null ? (IActionResult) new NotFoundResult() : new OkObjectResult(project)); }
public async Task RunActivity( [ActivityTrigger] IDurableActivityContext functionContext) { if (functionContext is null) { throw new ArgumentNullException(nameof(functionContext)); } var(projectId, principalId) = functionContext.GetInput <(Guid, Guid)>(); var project = await projectsRepository .GetAsync(projectId) .ConfigureAwait(false); if (project is null) { throw new RetryCanceledException($"Could not find project '{projectId}'"); } if (!string.IsNullOrEmpty(project.ResourceGroup?.ResourceGroupId)) { await EnsureResourceGroupAccessAsync(project, principalId).ConfigureAwait(false); } if (!string.IsNullOrEmpty(project.KeyVault?.VaultId)) { await EnsureKeyVaultAccessAsync(project, principalId).ConfigureAwait(false); } }
public async Task <IActionResult> Get() { if (!ProjectId.HasValue) { return(new NotFoundResult()); } var project = await projectsRepository .GetAsync(ProjectId.Value) .ConfigureAwait(false); var users = project?.Users; return(users is null ? (IActionResult) new NotFoundResult() : new OkObjectResult(users)); }