public async Task <PublishStatusResponseModel> EditSpecificationStatus( string specificationId, Common.Models.Versioning.PublishStatus publishStatus) { ApiResponse <PublishStatusResponseModel> response = await _resiliencePolicy.ExecuteAsync(() => _specifications.UpdateSpecificationStatus( specificationId, new Common.Models.Versioning.PublishStatusRequestModel { PublishStatus = publishStatus })); return(response?.Content); }
public async Task <IActionResult> EditSpecificationStatus(string specificationId, [FromBody] PublishStatusEditModel publishStatusEditModel) { Guard.IsNullOrWhiteSpace(specificationId, nameof(specificationId)); Guard.ArgumentNotNull(publishStatusEditModel, nameof(publishStatusEditModel)); if (!await _authorizationHelper.DoesUserHavePermission(User, specificationId, SpecificationActionTypes.CanApproveSpecification)) { return(new ForbidResult()); } ApiResponse <PublishStatusResponseModel> response = await _specificationsApiClient.UpdateSpecificationStatus(specificationId, new PublishStatusRequestModel { PublishStatus = publishStatusEditModel.PublishStatus.AsMatchingEnum <Common.Models.Versioning.PublishStatus>() }); if (response.StatusCode == HttpStatusCode.OK) { return(Ok(response.Content)); } throw new InvalidOperationException($"An error occurred while retrieving code context. Status code={response.StatusCode}"); }