Skip to content

Commit

Permalink
Merge pull request #369 from DigitalExcellence/release/1.0.1
Browse files Browse the repository at this point in the history
  • Loading branch information
Brend-Smits authored Jan 31, 2021
2 parents 5c333d9 + b0b8451 commit 802189d
Show file tree
Hide file tree
Showing 2 changed files with 51 additions and 0 deletions.
10 changes: 10 additions & 0 deletions API/Startup.cs
Original file line number Diff line number Diff line change
Expand Up @@ -442,6 +442,16 @@ private static void UpdateDatabase(IApplicationBuilder app, IWebHostEnvironment

// TODO seed embedded projects
}
// Seed call to action options
List<CallToActionOption> options = Seed.SeedCallToActionOptions();
foreach(CallToActionOption callToActionOption in options)
{
if(!context.CallToActionOption.Any(s => s.Type == callToActionOption.Type && s.Value == callToActionOption.Value))
{
context.CallToActionOption.Add(callToActionOption);
context.SaveChanges();
}
}
}

/// <summary>
Expand Down
41 changes: 41 additions & 0 deletions Data/Helpers/Seed.cs
Original file line number Diff line number Diff line change
Expand Up @@ -257,5 +257,46 @@ public static List<Highlight> SeedHighlights(List<Project> projects)

return highlights;
}

/// <summary>
/// This method seeds call to action options.
/// </summary>
/// <returns>Returns a list of call to actions options that can be seeded into the database.</returns>
public static List<CallToActionOption> SeedCallToActionOptions()
{
return new List<CallToActionOption>
{
new CallToActionOption
{
Type = "title",
Value = "Join today"
},
new CallToActionOption
{
Type = "title",
Value = "Provide feedback"
},
new CallToActionOption
{
Type = "title",
Value = "Apply now"
},
new CallToActionOption
{
Type = "title",
Value = "Collaborate with us"
},
new CallToActionOption
{
Type = "title",
Value = "More information"
},
new CallToActionOption
{
Type = "title",
Value = "Get in touch"
},
};
}
}
}

0 comments on commit 802189d

Please sign in to comment.