35 lines
924 B
C#
35 lines
924 B
C#
using System.Collections.Generic;
|
|
using BlueWest.Data;
|
|
using BlueWest.WebApi.EF.Model;
|
|
using Microsoft.EntityFrameworkCore;
|
|
|
|
namespace BlueWest.WebApi.Extensions
|
|
{
|
|
public static class ModelBuilderMigrationExtensions
|
|
{
|
|
/// <summary>
|
|
/// Setup the database model
|
|
/// </summary>
|
|
/// <param name="modelBuilder"></param>
|
|
public static void AddCurrencyAndCountryData(this ModelBuilder modelBuilder)
|
|
{
|
|
|
|
var countriesToAdd = new List<Country>();
|
|
var country = new Country();
|
|
|
|
country.Id = 1;
|
|
country.Code = 1;
|
|
country.Name = "United States";
|
|
country.Alpha2Code = "US";
|
|
country.StateName = "United States of America";
|
|
countriesToAdd.Add(country);
|
|
|
|
modelBuilder
|
|
.Entity<Country>()
|
|
.HasData(countriesToAdd.ToArray());
|
|
}
|
|
|
|
}
|
|
}
|
|
|