Fungerande version av skiktad lösning Winforms App med SQlite och entity framework

This commit is contained in:
2023-08-23 21:25:09 +02:00
parent 1f39c39d96
commit 40632aa92c
17 changed files with 485 additions and 6 deletions

View File

@ -0,0 +1,38 @@
using System;
using System.Collections.Generic;
using System.Linq;
using System.Text;
using System.Threading.Tasks;
using WinFormDiApp.BL.Models;
namespace WinFormDiApp.DAL.Data
{
public class DataSeeder
{
public static void Initialize(ApplicationDbContext context)
{
if (!context.Members.Any())
{
var members = new List<Member>()
{
new Member { /*Id = 1,*/ FirstName = "John", LastName="Doe", NickName="Doey", PersonType="Normal", Email = "john@john.com" },
new Member { /*Id = 2,*/ FirstName = "Michael", LastName="Jordan", NickName="Joardie", PersonType="Normal", Email = "michael@michael.com" }
};
context.Members.AddRange(members);
context.SaveChanges();
}
if (!context.AccountRecords.Any())
{
var accountRecords = new List<AccountRecord>()
{
new AccountRecord { /* Id = 1 */ Avisering = "EInvoice", Belopp=10.0, BetalDatum=DateTime.Parse("2023-05-05"), Konto="BG 5787-1030", Mottagare="Kalles Bärplockning" },
new AccountRecord { /* Id = 1 */ Avisering = "EInvoice", Belopp = 13.0, BetalDatum = DateTime.Parse("2023-05-07"), Konto = "PG 4158502-7", Mottagare = "Nisses Strumpor" }
};
context.AccountRecords.AddRange(accountRecords);
context.SaveChanges();
}
}
}
}