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