Skip to content

Commit

Permalink
sdk and aazure storage update
Browse files Browse the repository at this point in the history
better sample
  • Loading branch information
sandorfr committed Oct 8, 2016
1 parent 048743e commit bb398a3
Show file tree
Hide file tree
Showing 3 changed files with 54 additions and 2 deletions.
2 changes: 1 addition & 1 deletion global.json
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
{
"projects": [ "src", "tests", "samples" ],
"sdk": {
"version": "1.0.0-preview2-003121"
"version": "1.0.0-preview2-003133"
}
}
Original file line number Diff line number Diff line change
@@ -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<IEnumerable<string>> 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<string> 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);
}
}
}
2 changes: 1 addition & 1 deletion src/GeekLearning.Storage.Azure/project.json
Original file line number Diff line number Diff line change
Expand Up @@ -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"
},
Expand Down

0 comments on commit bb398a3

Please sign in to comment.