Skip to content

Commit 4dc8b65

Browse files
committed
Add Marketing.API project
1 parent 99890b9 commit 4dc8b65

18 files changed

Lines changed: 382 additions & 2 deletions

cli-windows/add-firewall-rules-for-sts-auth-thru-docker.ps1

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -21,6 +21,6 @@ try {
2121
Write-Host "Rule found"
2222
}
2323
catch [Exception] {
24-
New-NetFirewallRule -DisplayName eShopOnContainers-Inbound -Confirm -Description "eShopOnContainers Inbound Rule for port range 5100-5105" -LocalAddress Any -LocalPort 5100-5105 -Protocol tcp -RemoteAddress Any -RemotePort Any -Direction Inbound
25-
New-NetFirewallRule -DisplayName eShopOnContainers-Outbound -Confirm -Description "eShopOnContainers Outbound Rule for port range 5100-5105" -LocalAddress Any -LocalPort 5100-5105 -Protocol tcp -RemoteAddress Any -RemotePort Any -Direction Outbound
24+
New-NetFirewallRule -DisplayName eShopOnContainers-Inbound -Confirm -Description "eShopOnContainers Inbound Rule for port range 5100-5110" -LocalAddress Any -LocalPort 5100-5110 -Protocol tcp -RemoteAddress Any -RemotePort Any -Direction Inbound
25+
New-NetFirewallRule -DisplayName eShopOnContainers-Outbound -Confirm -Description "eShopOnContainers Outbound Rule for port range 5100-5110" -LocalAddress Any -LocalPort 5100-5110 -Protocol tcp -RemoteAddress Any -RemotePort Any -Direction Outbound
2626
}
Lines changed: 3 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,3 @@
1+
*
2+
!obj/Docker/publish/*
3+
!obj/Docker/empty/
Lines changed: 36 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,36 @@
1+
namespace Microsoft.eShopOnContainers.Services.Marketing.API.Controllers
2+
{
3+
using System.Collections.Generic;
4+
using Microsoft.AspNetCore.Mvc;
5+
6+
[Route("api/[controller]")]
7+
public class CampaignsController : Controller
8+
{
9+
[HttpGet]
10+
public IEnumerable<string> Get()
11+
{
12+
return new string[] { "value1", "value2" };
13+
}
14+
15+
[HttpGet("{id:int}")]
16+
public string Get(int id)
17+
{
18+
return "value";
19+
}
20+
21+
[HttpPost]
22+
public void Post([FromBody]string value)
23+
{
24+
}
25+
26+
[HttpPut("{id:int}")]
27+
public void Put(int id, [FromBody]string value)
28+
{
29+
}
30+
31+
[HttpDelete("{id:int}")]
32+
public void Delete(int id)
33+
{
34+
}
35+
}
36+
}
Lines changed: 13 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,13 @@
1+
namespace Microsoft.eShopOnContainers.Services.Marketing.API.Controllers
2+
{
3+
using Microsoft.AspNetCore.Mvc;
4+
5+
// GET: /<controller>/
6+
public class HomeController : Controller
7+
{
8+
public IActionResult Index()
9+
{
10+
return new RedirectResult("~/swagger");
11+
}
12+
}
13+
}
Lines changed: 6 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,6 @@
1+
FROM microsoft/aspnetcore:1.1
2+
ARG source
3+
WORKDIR /app
4+
EXPOSE 80
5+
COPY ${source:-obj/Docker/publish} .
6+
ENTRYPOINT ["dotnet", "Marketing.API.dll"]
Lines changed: 25 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,25 @@
1+
namespace Microsoft.eShopOnContainers.Services.Marketing.API.Infrastructure
2+
{
3+
using Microsoft.EntityFrameworkCore;
4+
using Microsoft.EntityFrameworkCore.Metadata.Builders;
5+
using Microsoft.eShopOnContainers.Services.Marketing.API.Model;
6+
7+
public class MarketingContext : DbContext
8+
{
9+
public MarketingContext(DbContextOptions options) : base(options)
10+
{
11+
}
12+
13+
public DbSet<Campaing> Campaings { get; set; }
14+
15+
protected override void OnModelCreating(ModelBuilder builder)
16+
{
17+
builder.Entity<Campaing>(ConfigureCampaings);
18+
}
19+
20+
void ConfigureCampaings(EntityTypeBuilder<Campaing> builder)
21+
{
22+
23+
}
24+
}
25+
}
Lines changed: 20 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,20 @@
1+
namespace Microsoft.eShopOnContainers.Services.Marketing.API.Infrastructure
2+
{
3+
using Microsoft.AspNetCore.Builder;
4+
using Microsoft.EntityFrameworkCore;
5+
using Microsoft.Extensions.Logging;
6+
using System.Threading.Tasks;
7+
8+
public class MarketingContextSeed
9+
{
10+
public static async Task SeedAsync(IApplicationBuilder applicationBuilder, ILoggerFactory loggerFactory, int? retry = 0)
11+
{
12+
var context = (MarketingContext)applicationBuilder
13+
.ApplicationServices.GetService(typeof(MarketingContext));
14+
15+
context.Database.Migrate();
16+
17+
//TODO: add model seeding
18+
}
19+
}
20+
}
Lines changed: 56 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,56 @@
1+
<Project Sdk="Microsoft.NET.Sdk.Web">
2+
3+
<PropertyGroup>
4+
<TargetFramework>netcoreapp1.1</TargetFramework>
5+
<DockerComposeProjectPath>..\..\..\..\docker-compose.dcproj</DockerComposeProjectPath>
6+
<RootNamespace>Microsoft.eShopOnContainers.Services.Marketing.API</RootNamespace>
7+
<PackageTargetFallback>portable-net45+win8</PackageTargetFallback>
8+
<UserSecretsId>aspnet-TestApp-ce941b30-19cf-4972-b34f-d03f2e7976ed</UserSecretsId>
9+
</PropertyGroup>
10+
11+
<ItemGroup>
12+
<Folder Include="IntegrationEvents\EventHandling\" />
13+
<Folder Include="IntegrationEvents\Events\" />
14+
<Folder Include="wwwroot\" />
15+
</ItemGroup>
16+
<ItemGroup>
17+
<PackageReference Include="IdentityServer4.AccessTokenValidation" Version="1.2.0" />
18+
<PackageReference Include="Microsoft.ApplicationInsights.AspNetCore" Version="2.0.0" />
19+
<PackageReference Include="Microsoft.AspNetCore" Version="1.1.2" />
20+
<PackageReference Include="Microsoft.AspNetCore.Mvc" Version="1.1.3" />
21+
<PackageReference Include="Microsoft.EntityFrameworkCore" Version="1.1.2" />
22+
<PackageReference Include="Microsoft.EntityFrameworkCore.Design" Version="1.1.2" />
23+
<PackageReference Include="Microsoft.EntityFrameworkCore.Relational" Version="1.1.2" />
24+
<PackageReference Include="Microsoft.EntityFrameworkCore.SqlServer" Version="1.1.2" />
25+
<PackageReference Include="Microsoft.EntityFrameworkCore.SqlServer.Design" Version="1.1.2" />
26+
<PackageReference Include="Microsoft.EntityFrameworkCore.Tools" Version="1.1.1" />
27+
<PackageReference Include="Microsoft.Extensions.Configuration.EnvironmentVariables" Version="1.1.2" />
28+
<PackageReference Include="Microsoft.Extensions.Configuration.UserSecrets" Version="1.1.2" />
29+
<PackageReference Include="Microsoft.Extensions.Logging.Debug" Version="1.1.2" />
30+
<PackageReference Include="Microsoft.Extensions.Options" Version="1.1.2" />
31+
<PackageReference Include="Microsoft.Extensions.Options.ConfigurationExtensions" Version="1.1.2" />
32+
<PackageReference Include="Swashbuckle.AspNetCore" Version="1.0.0" /><PackageReference Include="IdentityServer4.AccessTokenValidation" Version="1.2.0" />
33+
<PackageReference Include="Microsoft.ApplicationInsights.AspNetCore" Version="2.0.0" />
34+
<PackageReference Include="Microsoft.AspNetCore" Version="1.1.2" />
35+
<PackageReference Include="Microsoft.AspNetCore.Mvc" Version="1.1.3" />
36+
<PackageReference Include="Microsoft.EntityFrameworkCore" Version="1.1.2" />
37+
<PackageReference Include="Microsoft.EntityFrameworkCore.Design" Version="1.1.2" />
38+
<PackageReference Include="Microsoft.EntityFrameworkCore.Relational" Version="1.1.2" />
39+
<PackageReference Include="Microsoft.EntityFrameworkCore.SqlServer" Version="1.1.2" />
40+
<PackageReference Include="Microsoft.EntityFrameworkCore.SqlServer.Design" Version="1.1.2" />
41+
<PackageReference Include="Microsoft.EntityFrameworkCore.Tools" Version="1.1.1" />
42+
<PackageReference Include="Microsoft.Extensions.Configuration.EnvironmentVariables" Version="1.1.2" />
43+
<PackageReference Include="Microsoft.Extensions.Configuration.UserSecrets" Version="2.0.0-preview1-final" />
44+
<PackageReference Include="Microsoft.Extensions.Logging.Debug" Version="1.1.2" />
45+
<PackageReference Include="Microsoft.Extensions.Options" Version="1.1.2" />
46+
<PackageReference Include="Microsoft.Extensions.Options.ConfigurationExtensions" Version="1.1.2" />
47+
<PackageReference Include="Swashbuckle.AspNetCore" Version="1.0.0" />
48+
</ItemGroup>
49+
<ItemGroup>
50+
<DotNetCliToolReference Include="Microsoft.VisualStudio.Web.CodeGeneration.Tools" Version="1.0.1" />
51+
</ItemGroup>
52+
<ItemGroup>
53+
<DotNetCliToolReference Include="Microsoft.EntityFrameworkCore.Tools.DotNet" Version="1.0.0" />
54+
</ItemGroup>
55+
56+
</Project>
Lines changed: 7 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,7 @@
1+
namespace Microsoft.eShopOnContainers.Services.Marketing.API
2+
{
3+
public class MarketingSettings
4+
{
5+
public string ConnectionString { get; set; }
6+
}
7+
}
Lines changed: 7 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,7 @@
1+
namespace Microsoft.eShopOnContainers.Services.Marketing.API.Model
2+
{
3+
public class Campaing
4+
{
5+
//TODO: Add Campaing properties
6+
}
7+
}

0 commit comments

Comments
 (0)