Beispiel #1
0
        private async Task <bool> ProjecAlredyRequested(ProjectAdo projectAdo, string name, CancellationToken token)
        {
            if (token.IsCancellationRequested)
            {
                return(false);
            }

            if (projectAdo == null || string.IsNullOrWhiteSpace(projectAdo.Name) || string.IsNullOrWhiteSpace(projectAdo.Organization))
            {
                return(false);
            }

            try
            {
                var exisit = await _adoProjectRepository.ProjectExists(projectAdo.Organization, projectAdo.Name, projectAdo.Id);

                return(!exisit);
            }
            catch (Exception ex) { _logger.LogError(ex, nameof(ProjecAlredyRequested), projectAdo); }
            return(false);
        }
Beispiel #2
0
        public async Task <ActionResult <bool> > ProjectExists(string organization, string projectName, int projectId)
        {
            if (string.IsNullOrWhiteSpace(projectName) || string.IsNullOrWhiteSpace(organization))
            {
                return(BadRequest());
            }

            try
            {
                _logger.LogInformation(ApiLogEvents.GetItem, $"{nameof(ProjectExists)} with {projectName} {organization} Started");

                var res = await _repository.ProjectExists(organization, projectName, projectId).ConfigureAwait(false);

                return(res ? Ok(true) : NotFound());
            }
            catch (Exception ex)
            {
                _logger.LogError(ex, nameof(ProjectExists), projectName, organization, projectId);
                return(StatusCode(StatusCodes.Status500InternalServerError, ex?.Message));
            }
        }