Forum-Inzynieria1/Trunk/Server/Forum/Forum.DataAccessLayer/Migrations/Configuration.cs

45 lines
1.3 KiB
C#
Raw Normal View History

2018-12-02 00:19:58 +01:00
using System.Collections.Generic;
using Forum.DataAccessLayer.Models;
namespace Forum.DataAccessLayer.Migrations
{
using System;
using System.Data.Entity;
using System.Data.Entity.Migrations;
using System.Linq;
internal sealed class Configuration : DbMigrationsConfiguration<Forum.DataAccessLayer.ApplicationDbContext>
{
public Configuration()
{
AutomaticMigrationsEnabled = false;
}
protected override void Seed(Forum.DataAccessLayer.ApplicationDbContext context)
{
2018-12-02 00:19:58 +01:00
if (!context.Categories.Any(c=>c.CategoryName=="Zwroty"))
{
var zwroty = new Category()
{
CategoryName = "Zwroty",
Questions = new List<Question>()
{
new Question()
{
Title = "Jak dokona<6E> zwrotu",
Content = "Chce dosta<74> zwrot nwm co robic pls admian halp!11",
IsClosed = false,
PostDate = DateTime.Now,
Nick = "Potrzebuj<75>cy"
}
}
};
context.Categories.Add(zwroty);
2018-12-02 00:19:58 +01:00
context.SaveChanges();
}
}
}
}