# Conflicts: # docker-compose.vs.debug.yml # docker-compose.vs.release.yml # eShopOnContainers-ServicesAndWebApps.sln # src/Services/Location/Locations.API/Startup.cs # src/Services/Marketing/Marketing.API/Controllers/CampaignsController.cs # src/Services/Marketing/Marketing.API/Marketing.API.csproj # src/Services/Marketing/Marketing.API/Startup.cs # src/Web/WebMVC/appsettings.json # src/Web/WebSPA/AppSettings.cs # test/Services/FunctionalTests/Services/Marketing/MarketingScenarios.cspull/235/head
@ -0,0 +1,96 @@ | |||
| |||
Microsoft Visual Studio Solution File, Format Version 12.00 | |||
# Visual Studio 15 | |||
VisualStudioVersion = 15.0.26608.5 | |||
MinimumVisualStudioVersion = 10.0.40219.1 | |||
Project("{2150E333-8FDC-42A3-9474-1A3956D46DE8}") = "Infrastructure", "Infrastructure", "{5B1011EC-CEE5-47AA-B336-99381D573679}" | |||
EndProject | |||
Project("{2150E333-8FDC-42A3-9474-1A3956D46DE8}") = "AzureFunctions", "AzureFunctions", "{106B787C-2CFF-4484-8C07-D14589859E94}" | |||
EndProject | |||
Project("{9A19103F-16F7-4668-BE54-9A1E7A4F7556}") = "marketing-functions", "src\Services\Marketing\Infrastructure\AzureFunctions\marketing-functions.csproj", "{B363EF31-DD1A-46C8-ADDF-CD30A756E97B}" | |||
EndProject | |||
Global | |||
GlobalSection(SolutionConfigurationPlatforms) = preSolution | |||
Ad-Hoc|Any CPU = Ad-Hoc|Any CPU | |||
Ad-Hoc|ARM = Ad-Hoc|ARM | |||
Ad-Hoc|iPhone = Ad-Hoc|iPhone | |||
Ad-Hoc|iPhoneSimulator = Ad-Hoc|iPhoneSimulator | |||
Ad-Hoc|x64 = Ad-Hoc|x64 | |||
Ad-Hoc|x86 = Ad-Hoc|x86 | |||
AppStore|Any CPU = AppStore|Any CPU | |||
AppStore|ARM = AppStore|ARM | |||
AppStore|iPhone = AppStore|iPhone | |||
AppStore|iPhoneSimulator = AppStore|iPhoneSimulator | |||
AppStore|x64 = AppStore|x64 | |||
AppStore|x86 = AppStore|x86 | |||
Debug|Any CPU = Debug|Any CPU | |||
Debug|ARM = Debug|ARM | |||
Debug|iPhone = Debug|iPhone | |||
Debug|iPhoneSimulator = Debug|iPhoneSimulator | |||
Debug|x64 = Debug|x64 | |||
Debug|x86 = Debug|x86 | |||
Release|Any CPU = Release|Any CPU | |||
Release|ARM = Release|ARM | |||
Release|iPhone = Release|iPhone | |||
Release|iPhoneSimulator = Release|iPhoneSimulator | |||
Release|x64 = Release|x64 | |||
Release|x86 = Release|x86 | |||
EndGlobalSection | |||
GlobalSection(ProjectConfigurationPlatforms) = postSolution | |||
{B363EF31-DD1A-46C8-ADDF-CD30A756E97B}.Ad-Hoc|Any CPU.ActiveCfg = Debug|Any CPU | |||
{B363EF31-DD1A-46C8-ADDF-CD30A756E97B}.Ad-Hoc|Any CPU.Build.0 = Debug|Any CPU | |||
{B363EF31-DD1A-46C8-ADDF-CD30A756E97B}.Ad-Hoc|ARM.ActiveCfg = Debug|Any CPU | |||
{B363EF31-DD1A-46C8-ADDF-CD30A756E97B}.Ad-Hoc|ARM.Build.0 = Debug|Any CPU | |||
{B363EF31-DD1A-46C8-ADDF-CD30A756E97B}.Ad-Hoc|iPhone.ActiveCfg = Debug|Any CPU | |||
{B363EF31-DD1A-46C8-ADDF-CD30A756E97B}.Ad-Hoc|iPhone.Build.0 = Debug|Any CPU | |||
{B363EF31-DD1A-46C8-ADDF-CD30A756E97B}.Ad-Hoc|iPhoneSimulator.ActiveCfg = Debug|Any CPU | |||
{B363EF31-DD1A-46C8-ADDF-CD30A756E97B}.Ad-Hoc|iPhoneSimulator.Build.0 = Debug|Any CPU | |||
{B363EF31-DD1A-46C8-ADDF-CD30A756E97B}.Ad-Hoc|x64.ActiveCfg = Debug|Any CPU | |||
{B363EF31-DD1A-46C8-ADDF-CD30A756E97B}.Ad-Hoc|x64.Build.0 = Debug|Any CPU | |||
{B363EF31-DD1A-46C8-ADDF-CD30A756E97B}.Ad-Hoc|x86.ActiveCfg = Debug|Any CPU | |||
{B363EF31-DD1A-46C8-ADDF-CD30A756E97B}.Ad-Hoc|x86.Build.0 = Debug|Any CPU | |||
{B363EF31-DD1A-46C8-ADDF-CD30A756E97B}.AppStore|Any CPU.ActiveCfg = Debug|Any CPU | |||
{B363EF31-DD1A-46C8-ADDF-CD30A756E97B}.AppStore|Any CPU.Build.0 = Debug|Any CPU | |||
{B363EF31-DD1A-46C8-ADDF-CD30A756E97B}.AppStore|ARM.ActiveCfg = Debug|Any CPU | |||
{B363EF31-DD1A-46C8-ADDF-CD30A756E97B}.AppStore|ARM.Build.0 = Debug|Any CPU | |||
{B363EF31-DD1A-46C8-ADDF-CD30A756E97B}.AppStore|iPhone.ActiveCfg = Debug|Any CPU | |||
{B363EF31-DD1A-46C8-ADDF-CD30A756E97B}.AppStore|iPhone.Build.0 = Debug|Any CPU | |||
{B363EF31-DD1A-46C8-ADDF-CD30A756E97B}.AppStore|iPhoneSimulator.ActiveCfg = Debug|Any CPU | |||
{B363EF31-DD1A-46C8-ADDF-CD30A756E97B}.AppStore|iPhoneSimulator.Build.0 = Debug|Any CPU | |||
{B363EF31-DD1A-46C8-ADDF-CD30A756E97B}.AppStore|x64.ActiveCfg = Debug|Any CPU | |||
{B363EF31-DD1A-46C8-ADDF-CD30A756E97B}.AppStore|x64.Build.0 = Debug|Any CPU | |||
{B363EF31-DD1A-46C8-ADDF-CD30A756E97B}.AppStore|x86.ActiveCfg = Debug|Any CPU | |||
{B363EF31-DD1A-46C8-ADDF-CD30A756E97B}.AppStore|x86.Build.0 = Debug|Any CPU | |||
{B363EF31-DD1A-46C8-ADDF-CD30A756E97B}.Debug|Any CPU.ActiveCfg = Debug|Any CPU | |||
{B363EF31-DD1A-46C8-ADDF-CD30A756E97B}.Debug|Any CPU.Build.0 = Debug|Any CPU | |||
{B363EF31-DD1A-46C8-ADDF-CD30A756E97B}.Debug|ARM.ActiveCfg = Debug|Any CPU | |||
{B363EF31-DD1A-46C8-ADDF-CD30A756E97B}.Debug|ARM.Build.0 = Debug|Any CPU | |||
{B363EF31-DD1A-46C8-ADDF-CD30A756E97B}.Debug|iPhone.ActiveCfg = Debug|Any CPU | |||
{B363EF31-DD1A-46C8-ADDF-CD30A756E97B}.Debug|iPhone.Build.0 = Debug|Any CPU | |||
{B363EF31-DD1A-46C8-ADDF-CD30A756E97B}.Debug|iPhoneSimulator.ActiveCfg = Debug|Any CPU | |||
{B363EF31-DD1A-46C8-ADDF-CD30A756E97B}.Debug|iPhoneSimulator.Build.0 = Debug|Any CPU | |||
{B363EF31-DD1A-46C8-ADDF-CD30A756E97B}.Debug|x64.ActiveCfg = Debug|Any CPU | |||
{B363EF31-DD1A-46C8-ADDF-CD30A756E97B}.Debug|x64.Build.0 = Debug|Any CPU | |||
{B363EF31-DD1A-46C8-ADDF-CD30A756E97B}.Debug|x86.ActiveCfg = Debug|Any CPU | |||
{B363EF31-DD1A-46C8-ADDF-CD30A756E97B}.Debug|x86.Build.0 = Debug|Any CPU | |||
{B363EF31-DD1A-46C8-ADDF-CD30A756E97B}.Release|Any CPU.ActiveCfg = Release|Any CPU | |||
{B363EF31-DD1A-46C8-ADDF-CD30A756E97B}.Release|Any CPU.Build.0 = Release|Any CPU | |||
{B363EF31-DD1A-46C8-ADDF-CD30A756E97B}.Release|ARM.ActiveCfg = Release|Any CPU | |||
{B363EF31-DD1A-46C8-ADDF-CD30A756E97B}.Release|ARM.Build.0 = Release|Any CPU | |||
{B363EF31-DD1A-46C8-ADDF-CD30A756E97B}.Release|iPhone.ActiveCfg = Release|Any CPU | |||
{B363EF31-DD1A-46C8-ADDF-CD30A756E97B}.Release|iPhone.Build.0 = Release|Any CPU | |||
{B363EF31-DD1A-46C8-ADDF-CD30A756E97B}.Release|iPhoneSimulator.ActiveCfg = Release|Any CPU | |||
{B363EF31-DD1A-46C8-ADDF-CD30A756E97B}.Release|iPhoneSimulator.Build.0 = Release|Any CPU | |||
{B363EF31-DD1A-46C8-ADDF-CD30A756E97B}.Release|x64.ActiveCfg = Release|Any CPU | |||
{B363EF31-DD1A-46C8-ADDF-CD30A756E97B}.Release|x64.Build.0 = Release|Any CPU | |||
{B363EF31-DD1A-46C8-ADDF-CD30A756E97B}.Release|x86.ActiveCfg = Release|Any CPU | |||
{B363EF31-DD1A-46C8-ADDF-CD30A756E97B}.Release|x86.Build.0 = Release|Any CPU | |||
EndGlobalSection | |||
GlobalSection(SolutionProperties) = preSolution | |||
HideSolutionNode = FALSE | |||
EndGlobalSection | |||
GlobalSection(NestedProjects) = preSolution | |||
{106B787C-2CFF-4484-8C07-D14589859E94} = {5B1011EC-CEE5-47AA-B336-99381D573679} | |||
{B363EF31-DD1A-46C8-ADDF-CD30A756E97B} = {106B787C-2CFF-4484-8C07-D14589859E94} | |||
EndGlobalSection | |||
EndGlobal |
@ -0,0 +1,31 @@ | |||
| |||
using Microsoft.AspNetCore.Authorization; | |||
using Swashbuckle.AspNetCore.Swagger; | |||
using Swashbuckle.AspNetCore.SwaggerGen; | |||
using System.Collections.Generic; | |||
using System.Linq; | |||
namespace Microsoft.eShopOnContainers.Services.Locations.API.Infrastructure.Filters | |||
{ | |||
internal class AuthorizeCheckOperationFilter : IOperationFilter | |||
{ | |||
public void Apply(Operation operation, OperationFilterContext context) | |||
{ | |||
// Check for authorize attribute | |||
var hasAuthorize = context.ApiDescription.ControllerAttributes().OfType<AuthorizeAttribute>().Any() || | |||
context.ApiDescription.ActionAttributes().OfType<AuthorizeAttribute>().Any(); | |||
if (hasAuthorize) | |||
{ | |||
operation.Responses.Add("401", new Response { Description = "Unauthorized" }); | |||
operation.Responses.Add("403", new Response { Description = "Forbidden" }); | |||
operation.Security = new List<IDictionary<string, IEnumerable<string>>>(); | |||
operation.Security.Add(new Dictionary<string, IEnumerable<string>> | |||
{ | |||
{ "oauth2", new [] { "api1" } } | |||
}); | |||
} | |||
} | |||
} | |||
} |
@ -0,0 +1,16 @@ | |||
{ | |||
"bindings": [ | |||
{ | |||
"authLevel": "function", | |||
"name": "req", | |||
"type": "httpTrigger", | |||
"direction": "in" | |||
}, | |||
{ | |||
"name": "$return", | |||
"type": "http", | |||
"direction": "out" | |||
} | |||
], | |||
"disabled": false | |||
} |
@ -0,0 +1,21 @@ | |||
{ | |||
"frameworks": { | |||
"net46":{ | |||
"dependencies": { | |||
"Dapper": "1.50.2", | |||
"System.Data.SqlClient":"4.1.0", | |||
"Microsoft.WindowsAzure.ConfigurationManager":"3.2.1" | |||
} | |||
} | |||
} | |||
} |
@ -0,0 +1,91 @@ | |||
using System.Net; | |||
using System.Net.Http.Headers; | |||
using System.Configuration; | |||
using Dapper; | |||
using System.Data.SqlClient; | |||
public static async Task<HttpResponseMessage> Run(HttpRequestMessage req, TraceWriter log) | |||
{ | |||
log.Info($"Campaign HTTP trigger function processed a request. RequestUri={req.RequestUri}"); | |||
string htmlResponse = string.Empty; | |||
// parse query parameter | |||
string campaignId = req.GetQueryNameValuePairs() | |||
.FirstOrDefault(q => string.Compare(q.Key, "campaignId", true) == 0) | |||
.Value; | |||
string userId = req.GetQueryNameValuePairs() | |||
.FirstOrDefault(q => string.Compare(q.Key, "userId", true) == 0) | |||
.Value; | |||
var cnnString = ConfigurationManager.ConnectionStrings["SqlConnection"].ConnectionString; | |||
using (var conn = new SqlConnection(cnnString)) | |||
{ | |||
await conn.OpenAsync(); | |||
var sql = "SELECT * FROM [dbo].[Campaign] WHERE Id = @CampaignId;"; | |||
var campaign = (await conn.QueryAsync<Campaign>(sql, new { CampaignId = campaignId })).FirstOrDefault(); | |||
htmlResponse = BuildHtmlResponse(campaign); | |||
} | |||
var response = new HttpResponseMessage(HttpStatusCode.OK); | |||
response.Content = new ByteArrayContent(System.Text.Encoding.UTF8.GetBytes(htmlResponse)); | |||
response.Content.Headers.ContentType = new MediaTypeHeaderValue("text/html"); | |||
return response; | |||
} | |||
private static string BuildHtmlResponse(Campaign campaign) | |||
{ | |||
var marketingStorageUri = ConfigurationManager.AppSettings["MarketingStorageUri"]; | |||
return string.Format(@" | |||
<html> | |||
<head> | |||
<link href='https://maxcdn.bootstrapcdn.com/bootstrap/4.0.0-alpha.6/css/bootstrap.min.css' rel='stylesheet'> | |||
</head> | |||
<header> | |||
<title>Campaign Details</title> | |||
</header> | |||
<body> | |||
<div class='container'> | |||
</br> | |||
<div class='card-deck'> | |||
<div class='card text-center'> | |||
<img class='card-img-top' src='{0}' alt='Card image cap'> | |||
<div class='card-block'> | |||
<h4 class='card-title'>{1}</h4> | |||
<p class='card-text'>{2}</p> | |||
<div class='card-footer'> | |||
<small class='text-muted'>From {3} until {4}</small> | |||
</div> | |||
</div> | |||
</div> | |||
</div> | |||
</div> | |||
</body> | |||
</html>", | |||
$"{marketingStorageUri}{campaign.PictureName}", | |||
campaign.Name, | |||
campaign.Description, | |||
campaign.From.ToString("MMMM dd, yyyy"), | |||
campaign.From.ToString("MMMM dd, yyyy")); | |||
} | |||
public class Campaign | |||
{ | |||
public int Id { get; set; } | |||
public string Name { get; set; } | |||
public string Description { get; set; } | |||
public DateTime From { get; set; } | |||
public DateTime To { get; set; } | |||
public string PictureUri { get; set; } | |||
public string PictureName { get; set; } | |||
} |
@ -0,0 +1 @@ | |||
{} |
@ -0,0 +1,17 @@ | |||
{ | |||
"IsEncrypted": false, | |||
"Value": { | |||
"APPSETTING_FUNCTIONS_EXTENSION_VERSION": "~1", | |||
"APPSETTING_ScmType": "None", | |||
"APPSETTING_WEBSITE_AUTH_ENABLED": "False", | |||
"APPSETTING_REMOTEDEBUGGINGVERSION": "11.0.611103.400", | |||
"APPSETTING_AzureWebJobsDashboard": "", | |||
"APPSETTING_MarketingStorageUri": "", | |||
"APPSETTING_WEBSITE_NODE_DEFAULT_VERSION": "6.5.0", | |||
"APPSETTING_WEBSITE_CONTENTAZUREFILECONNECTIONSTRING": "", | |||
"APPSETTING_WEBSITE_CONTENTSHARE": "", | |||
"APPSETTING_WEBSITE_SLOT_NAME": "", | |||
"APPSETTING_AzureWebJobsStorage": "", | |||
"APPSETTING_WEBSITE_SITE_NAME": "" | |||
} | |||
} |
@ -0,0 +1,33 @@ | |||
<Project Sdk="Microsoft.NET.Sdk"> | |||
<PropertyGroup> | |||
<TargetFramework>net461</TargetFramework> | |||
</PropertyGroup> | |||
<ItemGroup> | |||
<PackageReference Include="Microsoft.Azure.WebJobs" Version="2.1.0-beta1" /> | |||
<PackageReference Include="Microsoft.Azure.WebJobs.Extensions.Http" Version="1.0.0-beta1" /> | |||
<PackageReference Include="Microsoft.NET.Sdk.Functions" Version="1.0.0-alpha5" /> | |||
</ItemGroup> | |||
<ItemGroup> | |||
<Reference Include="Microsoft.CSharp" /> | |||
</ItemGroup> | |||
<ItemGroup> | |||
<None Update="host.json"> | |||
<CopyToOutputDirectory>Always</CopyToOutputDirectory> | |||
</None> | |||
<None Update="MarketingDetailsHttpTrigger/function.json"> | |||
<CopyToOutputDirectory>Always</CopyToOutputDirectory> | |||
</None> | |||
<None Update="MarketingDetailsHttpTrigger/project.json"> | |||
<CopyToOutputDirectory>Always</CopyToOutputDirectory> | |||
</None> | |||
<None Update="MarketingDetailsHttpTrigger/project.lock.json"> | |||
<CopyToOutputDirectory>Always</CopyToOutputDirectory> | |||
</None> | |||
<None Update="MarketingDetailsHttpTrigger/run.csx"> | |||
<CopyToOutputDirectory>Always</CopyToOutputDirectory> | |||
</None> | |||
<None Update="local.settings.json"> | |||
<CopyToOutputDirectory>Always</CopyToOutputDirectory> | |||
</None> | |||
</ItemGroup> | |||
</Project> |
@ -0,0 +1,121 @@ | |||
using System; | |||
using Microsoft.EntityFrameworkCore; | |||
using Microsoft.EntityFrameworkCore.Infrastructure; | |||
using Microsoft.EntityFrameworkCore.Metadata; | |||
using Microsoft.EntityFrameworkCore.Migrations; | |||
using Microsoft.eShopOnContainers.Services.Marketing.API.Infrastructure; | |||
namespace Microsoft.eShopOnContainers.Services.Marketing.API.Infrastructure.MarketingMigrations | |||
{ | |||
[DbContext(typeof(MarketingContext))] | |||
[Migration("20170629102516_added-campaign-details")] | |||
partial class addedcampaigndetails | |||
{ | |||
protected override void BuildTargetModel(ModelBuilder modelBuilder) | |||
{ | |||
modelBuilder | |||
.HasAnnotation("ProductVersion", "1.1.2") | |||
.HasAnnotation("SqlServer:Sequence:.campaign_hilo", "'campaign_hilo', '', '1', '10', '', '', 'Int64', 'False'") | |||
.HasAnnotation("SqlServer:Sequence:.rule_hilo", "'rule_hilo', '', '1', '10', '', '', 'Int64', 'False'") | |||
.HasAnnotation("SqlServer:ValueGenerationStrategy", SqlServerValueGenerationStrategy.IdentityColumn); | |||
modelBuilder.Entity("Microsoft.eShopOnContainers.Services.Marketing.API.Model.Campaign", b => | |||
{ | |||
b.Property<int>("Id") | |||
.ValueGeneratedOnAdd() | |||
.HasAnnotation("SqlServer:HiLoSequenceName", "campaign_hilo") | |||
.HasAnnotation("SqlServer:ValueGenerationStrategy", SqlServerValueGenerationStrategy.SequenceHiLo); | |||
b.Property<string>("Description") | |||
.IsRequired() | |||
.HasColumnName("Description"); | |||
b.Property<string>("DetailsUri"); | |||
b.Property<DateTime>("From") | |||
.HasColumnName("From"); | |||
b.Property<string>("Name") | |||
.IsRequired() | |||
.HasColumnName("Name"); | |||
b.Property<string>("PictureName"); | |||
b.Property<string>("PictureUri") | |||
.IsRequired() | |||
.HasColumnName("PictureUri"); | |||
b.Property<DateTime>("To") | |||
.HasColumnName("To"); | |||
b.HasKey("Id"); | |||
b.ToTable("Campaign"); | |||
}); | |||
modelBuilder.Entity("Microsoft.eShopOnContainers.Services.Marketing.API.Model.Rule", b => | |||
{ | |||
b.Property<int>("Id") | |||
.ValueGeneratedOnAdd() | |||
.HasAnnotation("SqlServer:HiLoSequenceName", "rule_hilo") | |||
.HasAnnotation("SqlServer:ValueGenerationStrategy", SqlServerValueGenerationStrategy.SequenceHiLo); | |||
b.Property<int>("CampaignId"); | |||
b.Property<string>("Description") | |||
.IsRequired() | |||
.HasColumnName("Description"); | |||
b.Property<int>("RuleTypeId"); | |||
b.HasKey("Id"); | |||
b.HasIndex("CampaignId"); | |||
b.ToTable("Rule"); | |||
b.HasDiscriminator<int>("RuleTypeId"); | |||
}); | |||
modelBuilder.Entity("Microsoft.eShopOnContainers.Services.Marketing.API.Model.PurchaseHistoryRule", b => | |||
{ | |||
b.HasBaseType("Microsoft.eShopOnContainers.Services.Marketing.API.Model.Rule"); | |||
b.ToTable("PurchaseHistoryRule"); | |||
b.HasDiscriminator().HasValue(2); | |||
}); | |||
modelBuilder.Entity("Microsoft.eShopOnContainers.Services.Marketing.API.Model.UserLocationRule", b => | |||
{ | |||
b.HasBaseType("Microsoft.eShopOnContainers.Services.Marketing.API.Model.Rule"); | |||
b.Property<int>("LocationId") | |||
.HasColumnName("LocationId"); | |||
b.ToTable("UserLocationRule"); | |||
b.HasDiscriminator().HasValue(3); | |||
}); | |||
modelBuilder.Entity("Microsoft.eShopOnContainers.Services.Marketing.API.Model.UserProfileRule", b => | |||
{ | |||
b.HasBaseType("Microsoft.eShopOnContainers.Services.Marketing.API.Model.Rule"); | |||
b.ToTable("UserProfileRule"); | |||
b.HasDiscriminator().HasValue(1); | |||
}); | |||
modelBuilder.Entity("Microsoft.eShopOnContainers.Services.Marketing.API.Model.Rule", b => | |||
{ | |||
b.HasOne("Microsoft.eShopOnContainers.Services.Marketing.API.Model.Campaign", "Campaign") | |||
.WithMany("Rules") | |||
.HasForeignKey("CampaignId") | |||
.OnDelete(DeleteBehavior.Cascade); | |||
}); | |||
} | |||
} | |||
} |
@ -0,0 +1,33 @@ | |||
using System; | |||
using System.Collections.Generic; | |||
using Microsoft.EntityFrameworkCore.Migrations; | |||
namespace Microsoft.eShopOnContainers.Services.Marketing.API.Infrastructure.MarketingMigrations | |||
{ | |||
public partial class addedcampaigndetails : Migration | |||
{ | |||
protected override void Up(MigrationBuilder migrationBuilder) | |||
{ | |||
migrationBuilder.AddColumn<string>( | |||
name: "DetailsUri", | |||
table: "Campaign", | |||
nullable: true); | |||
migrationBuilder.AddColumn<string>( | |||
name: "PictureName", | |||
table: "Campaign", | |||
nullable: true); | |||
} | |||
protected override void Down(MigrationBuilder migrationBuilder) | |||
{ | |||
migrationBuilder.DropColumn( | |||
name: "DetailsUri", | |||
table: "Campaign"); | |||
migrationBuilder.DropColumn( | |||
name: "PictureName", | |||
table: "Campaign"); | |||
} | |||
} | |||
} |
@ -1,17 +1,21 @@ | |||
@model CampaignItem | |||
<form asp-controller="Campaigns" asp-action="Details" asp-route-id="@Model.Id"> | |||
<div class="card-block"> | |||
<h4 class="card-title esh-campaigns-name">@Model.Name</h4> | |||
<img class="card-img-top esh-campaigns-thumbnail" src="@Model.PictureUri" alt="@Model.Name"> | |||
<input class="esh-campaigns-button" type="submit" value="More details"> | |||
@if (ViewBag.IsCampaignDetailFunctionActive == true) | |||
{ | |||
<input type="button" value="More Details" class="btn esh-campaigns-button" onClick="window.open('@Model.DetailsUri')"> | |||
} | |||
else | |||
{ | |||
<input class="esh-campaigns-button" type="submit" value="More details"> | |||
} | |||
</div> | |||
<div class="card-footer"> | |||
<small class="text-muted"> | |||
From @Model.From.ToString("MMMM dd, yyyy") until @Model.To.ToString("MMMM dd, yyyy") | |||
</small> | |||
</div> | |||
</div> | |||
</form> |