Add test pics (not demo pics) and PicController
This commit is contained in:
parent
08b4f9187a
commit
31423eebcb
@ -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");
|
||||
}
|
||||
}
|
||||
}
|
@ -12,6 +12,10 @@
|
||||
|
||||
<ItemGroup>
|
||||
<Folder Include="Infrastructure\MarketingMigrations\" />
|
||||
<Content Include="Pics\**\*;">
|
||||
<CopyToPublishDirectory>PreserveNewest</CopyToPublishDirectory>
|
||||
</Content>
|
||||
<Folder Include="Infrastructure\MarketingMigrations\" />
|
||||
</ItemGroup>
|
||||
<ItemGroup>
|
||||
<PackageReference Include="Autofac.Extensions.DependencyInjection" Version="4.1.0" />
|
||||
@ -53,4 +57,13 @@
|
||||
<ItemGroup>
|
||||
<ProjectReference Include="..\..\..\BuildingBlocks\EventBus\EventBusRabbitMQ\EventBusRabbitMQ.csproj" />
|
||||
</ItemGroup>
|
||||
|
||||
<ItemGroup>
|
||||
<None Update="Dockerfile">
|
||||
<CopyToOutputDirectory>Always</CopyToOutputDirectory>
|
||||
</None>
|
||||
<None Update="Pics\*">
|
||||
<CopyToOutputDirectory>PreserveNewest</CopyToOutputDirectory>
|
||||
</None>
|
||||
</ItemGroup>
|
||||
</Project>
|
||||
|
BIN
src/Services/Marketing/Marketing.API/Pics/1.png
Normal file
BIN
src/Services/Marketing/Marketing.API/Pics/1.png
Normal file
Binary file not shown.
After Width: | Height: | Size: 631 B |
BIN
src/Services/Marketing/Marketing.API/Pics/2.png
Normal file
BIN
src/Services/Marketing/Marketing.API/Pics/2.png
Normal file
Binary file not shown.
After Width: | Height: | Size: 1.6 KiB |
BIN
src/Services/Marketing/Marketing.API/Pics/3.png
Normal file
BIN
src/Services/Marketing/Marketing.API/Pics/3.png
Normal file
Binary file not shown.
After Width: | Height: | Size: 2.0 KiB |
BIN
src/Services/Marketing/Marketing.API/Pics/4.png
Normal file
BIN
src/Services/Marketing/Marketing.API/Pics/4.png
Normal file
Binary file not shown.
After Width: | Height: | Size: 1.3 KiB |
BIN
src/Services/Marketing/Marketing.API/Pics/5.png
Normal file
BIN
src/Services/Marketing/Marketing.API/Pics/5.png
Normal file
Binary file not shown.
After Width: | Height: | Size: 1.6 KiB |
BIN
src/Services/Marketing/Marketing.API/Pics/6.png
Normal file
BIN
src/Services/Marketing/Marketing.API/Pics/6.png
Normal file
Binary file not shown.
After Width: | Height: | Size: 2.2 KiB |
@ -12,6 +12,7 @@
|
||||
.UseKestrel()
|
||||
.UseContentRoot(Directory.GetCurrentDirectory())
|
||||
.UseStartup<Startup>()
|
||||
.UseWebRoot("Pics")
|
||||
.Build();
|
||||
|
||||
host.Run();
|
||||
|
Loading…
x
Reference in New Issue
Block a user