public void Seed() { var initialSidebars = new List <Sidebars> { new Sidebars { Name = "班级管理", Controller = "Class", Action = "Index" }, new Sidebars { Name = "老师管理", Controller = "Teacher", Action = "Index" }, new Sidebars { Name = "学生管理", Controller = "Student", Action = "Index" }, new Sidebars { Name = "课程科目管理", Controller = "Course", Action = "Index" }, new Sidebars { Name = "课程安排", Controller = "CoursMangement", Action = "Index" }, new Sidebars { Name = "顶部导航栏管理", Controller = "Actionlink", Action = "Index" }, new Sidebars { Name = "侧边栏管理", Controller = "Sidebar", Action = "Index" }, }; foreach (var bar in initialSidebars) { if (_context.Sidebars.Any(r => r.Name == bar.Name)) { continue; } _context.Sidebars.Add(bar); } _context.SaveChanges(); }
public void Seed() { var initialActionLinks = new List <Actionlinks> { new Actionlinks { Name = "主页", Controller = "Home", Action = "Index" } }; foreach (var action in initialActionLinks) { if (_context.Actionlinks.Any(r => r.Name == action.Name)) { continue; } _context.Actionlinks.Add(action); } _context.SaveChanges(); }
public void Seed() { var initialUsers = new List <Users> { new Users { Account = "admin", Name = "admin", Password = "******", } }; foreach (var action in initialUsers) { if (_context.Users.Any(r => r.Name == action.Name)) { continue; } _context.Users.Add(action); } _context.SaveChanges(); }