Browse Source

Add test pics (not demo pics) and PicController

pull/223/head
Christian Arenas 7 years ago
parent
commit
31423eebcb
9 changed files with 42 additions and 0 deletions
  1. +28
    -0
      src/Services/Marketing/Marketing.API/Controllers/PicController.cs
  2. +13
    -0
      src/Services/Marketing/Marketing.API/Marketing.API.csproj
  3. BIN
      src/Services/Marketing/Marketing.API/Pics/1.png
  4. BIN
      src/Services/Marketing/Marketing.API/Pics/2.png
  5. BIN
      src/Services/Marketing/Marketing.API/Pics/3.png
  6. BIN
      src/Services/Marketing/Marketing.API/Pics/4.png
  7. BIN
      src/Services/Marketing/Marketing.API/Pics/5.png
  8. BIN
      src/Services/Marketing/Marketing.API/Pics/6.png
  9. +1
    -0
      src/Services/Marketing/Marketing.API/Program.cs

+ 28
- 0
src/Services/Marketing/Marketing.API/Controllers/PicController.cs 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");
}
}
}

+ 13
- 0
src/Services/Marketing/Marketing.API/Marketing.API.csproj View File

@ -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 View File

Before After
Width: 256  |  Height: 180  |  Size: 631 B

BIN
src/Services/Marketing/Marketing.API/Pics/2.png View File

Before After
Width: 256  |  Height: 180  |  Size: 1.6 KiB

BIN
src/Services/Marketing/Marketing.API/Pics/3.png View File

Before After
Width: 256  |  Height: 180  |  Size: 2.0 KiB

BIN
src/Services/Marketing/Marketing.API/Pics/4.png View File

Before After
Width: 256  |  Height: 180  |  Size: 1.3 KiB

BIN
src/Services/Marketing/Marketing.API/Pics/5.png View File

Before After
Width: 256  |  Height: 180  |  Size: 1.6 KiB

BIN
src/Services/Marketing/Marketing.API/Pics/6.png View File

Before After
Width: 256  |  Height: 180  |  Size: 2.2 KiB

+ 1
- 0
src/Services/Marketing/Marketing.API/Program.cs View File

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


Loading…
Cancel
Save