using System.Collections.Generic;
using BlueWest.Data;
using Microsoft.EntityFrameworkCore;
namespace BlueWest.WebApi.Context.Extensions
{
public static class ModelBuilderCountryDbContextExtensions
{ ///
/// Setup the database model
///
///
public static void AddCurrencyAndCountryData(this ModelBuilder modelBuilder)
{
var currencies = new List();
var usaCountry = new Country();
usaCountry.Id = 1;
usaCountry.Code = 1;
usaCountry.Name = "United States";
usaCountry.Alpha2Code = "US";
usaCountry.StateName = "United States of America";
usaCountry.TLD = "us";
var germanyCountry = new Country();
germanyCountry.Id = 2;
germanyCountry.Code = 2;
germanyCountry.Name = "Germany";
germanyCountry.Alpha2Code = "DE";
germanyCountry.StateName = "Germany";
germanyCountry.TLD = "de";
var dolar = new Currency();
dolar.Id = 1;
dolar.Code = "USD";
dolar.Countries = new List();
dolar.Countries.Add(usaCountry);
dolar.Num = 1;
var euro = new Currency();
euro.Id = 2;
euro.Code = "EUR";
euro.Countries = new List();
euro.Countries.Add(germanyCountry);
euro.Num = 2;
modelBuilder
.Entity()
.HasData(currencies.ToArray());
}
}
}