Exemple #1
0
        public async Task <IActionResult> Delete(string typeParameter, string idParameter, [FromQuery] bool hardDelete)
        {
            string policy = PolicyNames.WritePolicy;

            if (hardDelete)
            {
                policy = PolicyNames.HardDeletePolicy;
            }

            AuthorizationResult authorizationResult = await _authorizationService.AuthorizeAsync(User, policy);

            if (!authorizationResult.Succeeded)
            {
                return(Forbid());
            }

            DeleteResourceResponse response = await _mediator.DeleteResourceAsync(new ResourceKey(typeParameter, idParameter), hardDelete, HttpContext.RequestAborted);

            return(FhirResult.NoContent().SetETagHeader(response.WeakETag));
        }
Exemple #2
0
 public async Task GivenAFhirMediator_WhenDeletingAResourceByVersionId_ThenMethodNotAllowedIsThrown(bool hardDelete)
 {
     await Assert.ThrowsAsync <MethodNotAllowedException>(async() => await _mediator.DeleteResourceAsync(new ResourceKey <Observation>("id1", "version1"), hardDelete));
 }
        public async Task <IActionResult> Delete(string typeParameter, string idParameter, [FromQuery] bool hardDelete)
        {
            DeleteResourceResponse response = await _mediator.DeleteResourceAsync(new ResourceKey(typeParameter, idParameter), hardDelete, HttpContext.RequestAborted);

            return(FhirResult.NoContent().SetETagHeader(response.WeakETag));
        }