示例#1
0
        public async Task InvokeAsync(
            HttpContext context,
            IAssetStorage assetStore,
            JsonService jsonService)
        {
            RestAsset restAsset = await jsonService.Deserialize <RestAsset>(context.Request.Body);

            Asset asset = restAsset.ToModel();

            await assetStore.CreateAsync(asset);

            var r = new ResourceCreated()
            {
                Id = asset.Id
            };

            string json = jsonService.Serialize(r);

            await context.Response.WriteAsync(json);
        }