Add Name property and rename Url to PictureUri
This commit is contained in:
parent
6b9a519332
commit
08b4f9187a
@ -88,10 +88,11 @@
|
|||||||
return NotFound();
|
return NotFound();
|
||||||
}
|
}
|
||||||
|
|
||||||
|
campaignToUpdate.Name = campaignDto.Name;
|
||||||
campaignToUpdate.Description = campaignDto.Description;
|
campaignToUpdate.Description = campaignDto.Description;
|
||||||
campaignToUpdate.From = campaignDto.From;
|
campaignToUpdate.From = campaignDto.From;
|
||||||
campaignToUpdate.To = campaignDto.To;
|
campaignToUpdate.To = campaignDto.To;
|
||||||
campaignToUpdate.Url = campaignDto.Url;
|
campaignToUpdate.PictureUri = campaignDto.PictureUri;
|
||||||
|
|
||||||
await _context.SaveChangesAsync();
|
await _context.SaveChangesAsync();
|
||||||
|
|
||||||
@ -166,10 +167,11 @@
|
|||||||
return new CampaignDTO
|
return new CampaignDTO
|
||||||
{
|
{
|
||||||
Id = campaign.Id,
|
Id = campaign.Id,
|
||||||
|
Name = campaign.Name,
|
||||||
Description = campaign.Description,
|
Description = campaign.Description,
|
||||||
From = campaign.From,
|
From = campaign.From,
|
||||||
To = campaign.To,
|
To = campaign.To,
|
||||||
Url = campaign.Url,
|
PictureUri = campaign.PictureUri
|
||||||
};
|
};
|
||||||
}
|
}
|
||||||
|
|
||||||
@ -178,10 +180,11 @@
|
|||||||
return new Campaign
|
return new Campaign
|
||||||
{
|
{
|
||||||
Id = campaignDto.Id,
|
Id = campaignDto.Id,
|
||||||
|
Name = campaignDto.Name,
|
||||||
Description = campaignDto.Description,
|
Description = campaignDto.Description,
|
||||||
From = campaignDto.From,
|
From = campaignDto.From,
|
||||||
To = campaignDto.To,
|
To = campaignDto.To,
|
||||||
Url = campaignDto.Url
|
PictureUri = campaignDto.PictureUri
|
||||||
};
|
};
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
@ -31,8 +31,8 @@
|
|||||||
.ForSqlServerUseSequenceHiLo("campaign_hilo")
|
.ForSqlServerUseSequenceHiLo("campaign_hilo")
|
||||||
.IsRequired();
|
.IsRequired();
|
||||||
|
|
||||||
builder.Property(m => m.Description)
|
builder.Property(m => m.Name)
|
||||||
.HasColumnName("Description")
|
.HasColumnName("Name")
|
||||||
.IsRequired();
|
.IsRequired();
|
||||||
|
|
||||||
builder.Property(m => m.From)
|
builder.Property(m => m.From)
|
||||||
@ -47,6 +47,10 @@
|
|||||||
.HasColumnName("Description")
|
.HasColumnName("Description")
|
||||||
.IsRequired();
|
.IsRequired();
|
||||||
|
|
||||||
|
builder.Property(m => m.PictureUri)
|
||||||
|
.HasColumnName("PictureUri")
|
||||||
|
.IsRequired();
|
||||||
|
|
||||||
builder.HasMany(m => m.Rules)
|
builder.HasMany(m => m.Rules)
|
||||||
.WithOne(r => r.Campaign)
|
.WithOne(r => r.Campaign)
|
||||||
.HasForeignKey(r => r.CampaignId)
|
.HasForeignKey(r => r.CampaignId)
|
||||||
|
@ -9,7 +9,7 @@
|
|||||||
using System.Linq;
|
using System.Linq;
|
||||||
using System.Threading.Tasks;
|
using System.Threading.Tasks;
|
||||||
|
|
||||||
public class MarketingContextSeed
|
public static class MarketingContextSeed
|
||||||
{
|
{
|
||||||
public static async Task SeedAsync(IApplicationBuilder applicationBuilder, ILoggerFactory loggerFactory, int? retry = 0)
|
public static async Task SeedAsync(IApplicationBuilder applicationBuilder, ILoggerFactory loggerFactory, int? retry = 0)
|
||||||
{
|
{
|
||||||
@ -33,10 +33,11 @@
|
|||||||
{
|
{
|
||||||
new Campaign
|
new Campaign
|
||||||
{
|
{
|
||||||
Description = "Campaign1",
|
Name = "Campaign Name 1",
|
||||||
|
Description = "Campaign Description 1",
|
||||||
From = DateTime.Now,
|
From = DateTime.Now,
|
||||||
To = DateTime.Now.AddDays(7),
|
To = DateTime.Now.AddDays(7),
|
||||||
Url = "http://CampaignUrl.test/12f09ed3cef54187123f500ad",
|
PictureUri = "http://externalcatalogbaseurltobereplaced/api/v1/campaigns/1/pic",
|
||||||
Rules = new List<Rule>
|
Rules = new List<Rule>
|
||||||
{
|
{
|
||||||
new UserLocationRule
|
new UserLocationRule
|
||||||
@ -48,10 +49,11 @@
|
|||||||
},
|
},
|
||||||
new Campaign
|
new Campaign
|
||||||
{
|
{
|
||||||
Description = "Campaign2",
|
Name = "Campaign Name 2",
|
||||||
|
Description = "Campaign Description 2",
|
||||||
From = DateTime.Now.AddDays(7),
|
From = DateTime.Now.AddDays(7),
|
||||||
To = DateTime.Now.AddDays(14),
|
To = DateTime.Now.AddDays(14),
|
||||||
Url = "http://CampaignUrl.test/02a59eda65f241871239000ff",
|
PictureUri = "http://externalcatalogbaseurltobereplaced/api/v1/campaigns/2/pic",
|
||||||
Rules = new List<Rule>
|
Rules = new List<Rule>
|
||||||
{
|
{
|
||||||
new UserLocationRule
|
new UserLocationRule
|
||||||
|
@ -8,8 +8,8 @@ using Microsoft.eShopOnContainers.Services.Marketing.API.Infrastructure;
|
|||||||
namespace Microsoft.eShopOnContainers.Services.Marketing.API.Infrastructure.MarketingMigrations
|
namespace Microsoft.eShopOnContainers.Services.Marketing.API.Infrastructure.MarketingMigrations
|
||||||
{
|
{
|
||||||
[DbContext(typeof(MarketingContext))]
|
[DbContext(typeof(MarketingContext))]
|
||||||
[Migration("20170609104915_Initial")]
|
[Migration("20170615163431_Init")]
|
||||||
partial class Initial
|
partial class Init
|
||||||
{
|
{
|
||||||
protected override void BuildTargetModel(ModelBuilder modelBuilder)
|
protected override void BuildTargetModel(ModelBuilder modelBuilder)
|
||||||
{
|
{
|
||||||
@ -33,11 +33,17 @@ namespace Microsoft.eShopOnContainers.Services.Marketing.API.Infrastructure.Mark
|
|||||||
b.Property<DateTime>("From")
|
b.Property<DateTime>("From")
|
||||||
.HasColumnName("From");
|
.HasColumnName("From");
|
||||||
|
|
||||||
|
b.Property<string>("Name")
|
||||||
|
.IsRequired()
|
||||||
|
.HasColumnName("Name");
|
||||||
|
|
||||||
|
b.Property<string>("PictureUri")
|
||||||
|
.IsRequired()
|
||||||
|
.HasColumnName("PictureUri");
|
||||||
|
|
||||||
b.Property<DateTime>("To")
|
b.Property<DateTime>("To")
|
||||||
.HasColumnName("To");
|
.HasColumnName("To");
|
||||||
|
|
||||||
b.Property<string>("Url");
|
|
||||||
|
|
||||||
b.HasKey("Id");
|
b.HasKey("Id");
|
||||||
|
|
||||||
b.ToTable("Campaign");
|
b.ToTable("Campaign");
|
@ -4,7 +4,7 @@ using Microsoft.EntityFrameworkCore.Migrations;
|
|||||||
|
|
||||||
namespace Microsoft.eShopOnContainers.Services.Marketing.API.Infrastructure.MarketingMigrations
|
namespace Microsoft.eShopOnContainers.Services.Marketing.API.Infrastructure.MarketingMigrations
|
||||||
{
|
{
|
||||||
public partial class Initial : Migration
|
public partial class Init : Migration
|
||||||
{
|
{
|
||||||
protected override void Up(MigrationBuilder migrationBuilder)
|
protected override void Up(MigrationBuilder migrationBuilder)
|
||||||
{
|
{
|
||||||
@ -23,8 +23,9 @@ namespace Microsoft.eShopOnContainers.Services.Marketing.API.Infrastructure.Mark
|
|||||||
Id = table.Column<int>(nullable: false),
|
Id = table.Column<int>(nullable: false),
|
||||||
Description = table.Column<string>(nullable: false),
|
Description = table.Column<string>(nullable: false),
|
||||||
From = table.Column<DateTime>(nullable: false),
|
From = table.Column<DateTime>(nullable: false),
|
||||||
To = table.Column<DateTime>(nullable: false),
|
Name = table.Column<string>(nullable: false),
|
||||||
Url = table.Column<string>(nullable: true)
|
PictureUri = table.Column<string>(nullable: false),
|
||||||
|
To = table.Column<DateTime>(nullable: false)
|
||||||
},
|
},
|
||||||
constraints: table =>
|
constraints: table =>
|
||||||
{
|
{
|
@ -32,11 +32,17 @@ namespace Microsoft.eShopOnContainers.Services.Marketing.API.Infrastructure.Mark
|
|||||||
b.Property<DateTime>("From")
|
b.Property<DateTime>("From")
|
||||||
.HasColumnName("From");
|
.HasColumnName("From");
|
||||||
|
|
||||||
|
b.Property<string>("Name")
|
||||||
|
.IsRequired()
|
||||||
|
.HasColumnName("Name");
|
||||||
|
|
||||||
|
b.Property<string>("PictureUri")
|
||||||
|
.IsRequired()
|
||||||
|
.HasColumnName("PictureUri");
|
||||||
|
|
||||||
b.Property<DateTime>("To")
|
b.Property<DateTime>("To")
|
||||||
.HasColumnName("To");
|
.HasColumnName("To");
|
||||||
|
|
||||||
b.Property<string>("Url");
|
|
||||||
|
|
||||||
b.HasKey("Id");
|
b.HasKey("Id");
|
||||||
|
|
||||||
b.ToTable("Campaign");
|
b.ToTable("Campaign");
|
||||||
|
@ -7,13 +7,15 @@
|
|||||||
{
|
{
|
||||||
public int Id { get; set; }
|
public int Id { get; set; }
|
||||||
|
|
||||||
|
public string Name { get; set; }
|
||||||
|
|
||||||
public string Description { get; set; }
|
public string Description { get; set; }
|
||||||
|
|
||||||
public DateTime From { get; set; }
|
public DateTime From { get; set; }
|
||||||
|
|
||||||
public DateTime To { get; set; }
|
public DateTime To { get; set; }
|
||||||
|
|
||||||
public string Url { get; set; }
|
public string PictureUri { get; set; }
|
||||||
|
|
||||||
public List<Rule> Rules { get; set; }
|
public List<Rule> Rules { get; set; }
|
||||||
|
|
||||||
|
Loading…
x
Reference in New Issue
Block a user