diff --git a/global.json b/global.json index 48cf56a..53c35ad 100644 --- a/global.json +++ b/global.json @@ -1,6 +1,6 @@ { "projects": [ "src", "tests", "samples" ], "sdk": { - "version": "1.0.0-preview2-003121" + "version": "1.0.0-preview2-003133" } } \ No newline at end of file diff --git a/samples/GeekLearning.Storage.BasicSample/Controllers/SampleController.cs b/samples/GeekLearning.Storage.BasicSample/Controllers/SampleController.cs new file mode 100644 index 0000000..7606c62 --- /dev/null +++ b/samples/GeekLearning.Storage.BasicSample/Controllers/SampleController.cs @@ -0,0 +1,52 @@ +using System; +using System.Collections.Generic; +using System.Linq; +using System.Threading.Tasks; +using Microsoft.AspNetCore.Mvc; +using System.Text; + +// For more information on enabling Web API for empty projects, visit http://go.microsoft.com/fwlink/?LinkID=397860 + +namespace GeekLearning.Storage.BasicSample.Controllers +{ + [Route("api/[controller]")] + public class SampleController : Controller + { + private IStore sharedAssets; + + public SampleController(IStorageFactory storageFactory) + { + this.sharedAssets = storageFactory.GetStore("SharedAssets"); + } + + // GET: api/values + [HttpGet] + public async Task> Get() + { + var summaries = await this.sharedAssets.ListAsync("summaries", "*.txt", recursive: true, withMetadata: false); + return summaries.Select(x => x.Path); + } + + // GET api/values/5 + [HttpGet] + public async Task Get(string path) + { + var summary = await this.sharedAssets.GetAsync(path); + return await summary.ReadAllTextAsync(); + } + + // PUT api/values/5 + [HttpPut()] + public async Task Put(string path, [FromBody]string value) + { + await sharedAssets.SaveAsync(Encoding.UTF8.GetBytes(value), path, "text/plain"); + } + + // DELETE api/values/5 + [HttpDelete()] + public async Task Delete(string path) + { + await sharedAssets.DeleteAsync(path); + } + } +} diff --git a/src/GeekLearning.Storage.Azure/project.json b/src/GeekLearning.Storage.Azure/project.json index 3917055..5cf632c 100644 --- a/src/GeekLearning.Storage.Azure/project.json +++ b/src/GeekLearning.Storage.Azure/project.json @@ -12,7 +12,7 @@ "NETStandard.Library": "1.6.0", "Microsoft.Extensions.DependencyInjection.Abstractions": "1.0.0", "Microsoft.Extensions.Options": "1.0.0", - "WindowsAzure.Storage": "7.2.0", + "WindowsAzure.Storage": "7.2.1", "GeekLearning.Storage": "*", "Microsoft.Extensions.FileSystemGlobbing": "1.0.0" },