Add test pics (not demo pics) and PicController

This commit is contained in:
Christian Arenas 2017-06-15 19:16:26 +02:00
parent 08b4f9187a
commit 31423eebcb
9 changed files with 42 additions and 0 deletions

View File

@ -0,0 +1,28 @@
namespace Microsoft.eShopOnContainers.Services.Marketing.API.Controllers
{
using Microsoft.AspNetCore.Hosting;
using Microsoft.AspNetCore.Mvc;
using System.IO;
public class PicController : Controller
{
private readonly IHostingEnvironment _env;
public PicController(IHostingEnvironment env)
{
_env = env;
}
[HttpGet]
[Route("api/v1/campaigns/{campaignId:int}/pic")]
public IActionResult GetImage(int campaignId)
{
var webRoot = _env.WebRootPath;
var path = Path.Combine(webRoot, campaignId + ".png");
var buffer = System.IO.File.ReadAllBytes(path);
return File(buffer, "image/png");
}
}
}

View File

@ -12,6 +12,10 @@
<ItemGroup> <ItemGroup>
<Folder Include="Infrastructure\MarketingMigrations\" /> <Folder Include="Infrastructure\MarketingMigrations\" />
<Content Include="Pics\**\*;">
<CopyToPublishDirectory>PreserveNewest</CopyToPublishDirectory>
</Content>
<Folder Include="Infrastructure\MarketingMigrations\" />
</ItemGroup> </ItemGroup>
<ItemGroup> <ItemGroup>
<PackageReference Include="Autofac.Extensions.DependencyInjection" Version="4.1.0" /> <PackageReference Include="Autofac.Extensions.DependencyInjection" Version="4.1.0" />
@ -53,4 +57,13 @@
<ItemGroup> <ItemGroup>
<ProjectReference Include="..\..\..\BuildingBlocks\EventBus\EventBusRabbitMQ\EventBusRabbitMQ.csproj" /> <ProjectReference Include="..\..\..\BuildingBlocks\EventBus\EventBusRabbitMQ\EventBusRabbitMQ.csproj" />
</ItemGroup> </ItemGroup>
<ItemGroup>
<None Update="Dockerfile">
<CopyToOutputDirectory>Always</CopyToOutputDirectory>
</None>
<None Update="Pics\*">
<CopyToOutputDirectory>PreserveNewest</CopyToOutputDirectory>
</None>
</ItemGroup>
</Project> </Project>

Binary file not shown.

After

Width:  |  Height:  |  Size: 631 B

Binary file not shown.

After

Width:  |  Height:  |  Size: 1.6 KiB

Binary file not shown.

After

Width:  |  Height:  |  Size: 2.0 KiB

Binary file not shown.

After

Width:  |  Height:  |  Size: 1.3 KiB

Binary file not shown.

After

Width:  |  Height:  |  Size: 1.6 KiB

Binary file not shown.

After

Width:  |  Height:  |  Size: 2.2 KiB

View File

@ -12,6 +12,7 @@
.UseKestrel() .UseKestrel()
.UseContentRoot(Directory.GetCurrentDirectory()) .UseContentRoot(Directory.GetCurrentDirectory())
.UseStartup<Startup>() .UseStartup<Startup>()
.UseWebRoot("Pics")
.Build(); .Build();
host.Run(); host.Run();