public void Seed() { var initialSideBar = new List <Sidebar> { new Sidebar { Name = "班级管理", Controller = "Classes", Action = "Index" }, new Sidebar { Name = "教师管理", Controller = "Teachers", Action = "Index" }, new Sidebar { Name = "学生管理", Controller = "Studebts", Action = "Index" }, new Sidebar { Name = "课程科目管理", Controller = "Courses", Action = "Index" }, new Sidebar { Name = "课程安排", Controller = "CoursesManadements", Action = "Index" }, new Sidebar { Name = "顶部导航栏管理", Controller = "ActionLinks", Action = "Index" }, new Sidebar { Name = "左侧导航栏管理", Controller = "Sidebars", Action = "Index" }, }; foreach (var bar in initialSideBar) { if (_context.Sidebar.Any(r => r.Name == bar.Name)) { continue; } _context.Sidebar.Add(bar); } _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(); }
public void Seed() { var initialActionLinks = new List <ActionLink> { new ActionLink { Name = "主页", Controller = "Home", Action = "Index" } }; foreach (var action in initialActionLinks) { if (_context.ActionLink.Any(r => r.Name == action.Name)) { continue; } _context.ActionLink.Add(action); } _context.SaveChanges(); }