Ejemplo n.º 1
0
        public async Task <bool> UpdateIssueStageAsync(IssueStage issueStageToUpdate)
        {
            _issueStageRepository.Update(issueStageToUpdate);
            var updated = await _issueStageRepository.SaveAsync().ConfigureAwait(false);

            return(updated > 0);
        }
Ejemplo n.º 2
0
        public async Task <bool> CreateIssueStageAsync(IssueStage issueStage)
        {
            await _issueStageRepository.CreateAsync(issueStage).ConfigureAwait(false);

            var created = await _issueStageRepository.SaveAsync().ConfigureAwait(false);

            return(created > 0);
        }
Ejemplo n.º 3
0
        public async Task <bool> DeleteIssueStageAsync(Guid issueStageId)
        {
            var issueStage = new IssueStage {
                Id = issueStageId
            };

            _issueStageRepository.Delete(issueStage);
            var deleted = await _issueStageRepository.SaveAsync().ConfigureAwait(false);

            return(deleted > 0);
        }
        public async Task <IActionResult> CreateIssueStageByUserProject([FromRoute] string username, [FromRoute] string projectName, [FromBody] CreateIssueStageRequest issueStageRequest)
        {
            if (issueStageRequest == null)
            {
                return(new BadRequestResult());
            }

            var project = await _projectService.GetProjectByUserAsync(username, projectName).ConfigureAwait(false);

            if (project == null)
            {
                return(new NotFoundResult());
            }

            var issueStage = await _issueStageService.GetIssueStageByProjectAsync(project.Id, issueStageRequest.Name).ConfigureAwait(false);

            if (issueStage != null)
            {
                return(new ConflictResult());
            }

            var newIssueStage = new IssueStage
            {
                Name      = issueStageRequest.Name,
                ProjectId = project.Id,
            };

            var created = await _issueStageService.CreateIssueStageAsync(newIssueStage).ConfigureAwait(false);

            var locationUri = _uriService.GetUri(newIssueStage.Name);

            if (created)
            {
                return(Created(locationUri, new Response <IssueStageResponse>(_mapper.Map <IssueStageResponse>(newIssueStage))));
            }
            return(NotFound());
        }