43 lines
1.3 KiB
C#
43 lines
1.3 KiB
C#
using System.Collections.Generic;
|
|
using Forum.DataAccessLayer.Models;
|
|
|
|
namespace Forum.DataAccessLayer.Migrations
|
|
{
|
|
using System;
|
|
using System.Linq;
|
|
|
|
internal sealed class Configuration : DbMigrationsConfiguration<Forum.DataAccessLayer.ApplicationDbContext>
|
|
{
|
|
public Configuration()
|
|
{
|
|
AutomaticMigrationsEnabled = false;
|
|
}
|
|
|
|
protected override void Seed(Forum.DataAccessLayer.ApplicationDbContext context)
|
|
{
|
|
if (!context.Categories.Any(c=>c.CategoryName=="Zwroty"))
|
|
{
|
|
var zwroty = new Category()
|
|
{
|
|
CategoryName = "Zwroty",
|
|
Questions = new List<Question>()
|
|
{
|
|
new Question()
|
|
{
|
|
Title = "Jak dokonaæ zwrotu",
|
|
Content = "Chce dostaæ zwrot nwm co robic pls admian halp!11",
|
|
IsClosed = false,
|
|
PostDate = DateTime.Now,
|
|
Nick = "Potrzebuj¹cy"
|
|
}
|
|
}
|
|
};
|
|
|
|
context.Categories.Add(zwroty);
|
|
|
|
context.SaveChanges();
|
|
}
|
|
}
|
|
}
|
|
}
|