public void Seed() { var initialUsers = new List <Users> { new Users { Account = "admin", Name = "admin", Passwd = "123456" } }; foreach (var action in initialUsers) { if (_content.Users.Any(r => r.Name == action.Name)) { continue; } _content.Users.Add(action); } _content.SaveChanges(); }
public void Seed() { var initialActiolink = new List <Actiolink> { new Actiolink { Name = "主页", Controller = "Home", Action = "Index" } }; foreach (var action in initialActiolink) { if (_content.Actiolink.Any(r => r.Name == action.Name)) { continue; } _content.Actiolink.Add(action); } _content.SaveChanges(); }
public void Seed() { var initialSidebars = new List <Sidebars> { new Sidebars { Name = "班级管理", Controller = "Classes", Action = "Index" }, new Sidebars { Name = "教师管理", Controller = "Teachers", Action = "Index" }, new Sidebars { Name = "学生管理", Controller = "Students", Action = "Index" } , new Sidebars { Name = "课程科目管理", Controller = "Courses", Action = "Index" } , new Sidebars { Name = "课程安排管理", Controller = "Subjects", Action = "Index" } , new Sidebars { Name = "课程表管理", Controller = "Subjects", Action = "Index" } , new Sidebars { Name = "左部导航栏管理", Controller = "Home", Action = "Index" } , new Sidebars { Name = "顶部导航栏管理", Controller = "Actiolinks", Action = "Index" } }; foreach (var bar in initialSidebars) { if (_content.Sidebars.Any(r => r.Name == bar.Name)) { continue; } _content.Sidebars.Add(bar); } _content.SaveChanges(); }