Esempio n. 1
0
        public async Task InvokeAsync(
            HttpContext context,
            IAssetFolderStorage assetStore,
            JsonService jsonService)
        {
            AssetFolderQuery query = await jsonService.Deserialize <AssetFolderQuery>(context.Request.Body);

            IEnumerable <AssetFolder> assets = await assetStore.GetAssetFoldersAsync(query);

            IEnumerable <RestAssetFolder> result = assets.Select(x => x.ToRest()).ToList();

            string json = jsonService.Serialize(result);

            await context.Response.WriteAsync(json);
        }
        public async Task InvokeAsync(
            HttpContext context,
            IAssetFolderStorage assetStore,
            JsonService jsonService)
        {
            Guid id = Guid.Parse((string)context.GetRouteValue("id"));

            var entity = await assetStore.GetAssetFolderAsync(id);

            RestAssetFolder restAsset = entity.ToRest();

            string json = jsonService.Serialize(restAsset);

            await context.Response.WriteAsync(json);
        }