public async Task <IActionResult> CreateProjectService(Guid organizationId, Guid projectId, [FromBody] InternalProjectServicePostRp projectServiceRp)
        {
            if (!ModelState.IsValid)
            {
                return(this.BadRequest(ModelState));
            }

            ProjectServicePostRp resource = new ProjectServicePostRp();

            resource.Name        = projectServiceRp.Name;
            resource.Description = projectServiceRp.Description;
            resource.ProjectServiceTemplateId = projectServiceRp.ProjectServiceTemplateId;

            await _projectServiceService.CreateProjectService(organizationId, projectId, resource, projectServiceRp.UserId);

            if (_domainManagerService.HasNotFounds())
            {
                return(this.NotFound(_domainManagerService.GetNotFounds()));
            }

            if (_domainManagerService.HasConflicts())
            {
                return(this.Conflict(_domainManagerService.GetConflicts()));
            }

            return(this.Ok());
        }
Esempio n. 2
0
        public async Task <IActionResult> CreateProjectService(Guid organizationId, Guid projectId, [FromBody] ProjectServicePostRp projectServiceRp)
        {
            if (!ModelState.IsValid)
            {
                return(this.BadRequest(ModelState));
            }

            await _projectServiceService.CreateProjectService(organizationId, projectId, projectServiceRp);

            if (_domainManagerService.HasNotFounds())
            {
                return(this.NotFound(_domainManagerService.GetNotFounds()));
            }

            if (_domainManagerService.HasForbidden())
            {
                return(this.Forbidden(_domainManagerService.GetForbidden()));
            }

            if (_domainManagerService.HasConflicts())
            {
                return(this.Conflict(_domainManagerService.GetConflicts()));
            }

            return(this.Ok(new { ServiceId = await _domainManagerService.GetResult <Guid>("ServiceId") }));
        }