Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
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