コード例 #1
0
        public async Task <HttpResponseMessage> Delete(string resource, string id)
        {
            HttpResponseMessage response;
            const string        respval = "";
            var retVal = await storage.LoadFhirResourceAsync(id, resource).ConfigureAwait(false);

            if (retVal != null)
            {
                await storage.DeleteFhirResourceAsync(retVal).ConfigureAwait(false);

                response = Request.CreateResponse(HttpStatusCode.NoContent);
                response.Headers.TryAddWithoutValidation("Accept", CurrentAcceptType);

                response.Content = new StringContent(respval, Encoding.UTF8);
                response.Headers.Add("ETag", "W/\"" + retVal.Meta.VersionId + "\"");
            }
            else
            {
                response         = Request.CreateResponse(HttpStatusCode.NotFound);
                response.Content = new StringContent("", Encoding.UTF8);
            }

            response.Content.Headers.TryAddWithoutValidation("Content-Type",
                                                             IsAccceptTypeJson ? Fhircontenttypejson : Fhircontenttypexml);
            return(response);
        }