public void seed() { var intialSidebars = new List <Sidebar> { new Sidebar { Name = "班级管理", Controller = "Classse", Action = "Index" }, new Sidebar { Name = "教师管理", Controller = "Teachers", Action = "Index" }, new Sidebar { Name = "学生管理", Controller = "Student", Action = "Index" }, new Sidebar { Name = "课程科目管理", Controller = "Course", Action = "Index" }, new Sidebar { Name = "课程安排", Controller = "CourseManagement", Action = "Index" }, new Sidebar { Name = "顶部导航栏管理", Controller = "Actionlink", Action = "Index" }, new Sidebar { Name = "侧面导航栏管理", Controller = "Sidebars", Action = "Index" } }; foreach (var bar in intialSidebars) { if (_context.Sidebar.Any(r => r.Name == bar.Name)) { continue; } _context.Sidebar.Add(bar); } _context.SaveChanges(); }
public void seed() { var intialUsers = new List <Users> { new Users { Account = "admin", UserName = "******", Passwoed = "123456" } }; foreach (var action in intialUsers) { if (_context.Users.Any(r => r.UserName == action.UserName)) { continue; } _context.Users.Add(action); } _context.SaveChanges(); }
public void seed() { var intialActionLinks = new List <ActionLink> { new ActionLink { Name = "主页", Controller = "Home", Action = "Index" } }; foreach (var action in intialActionLinks) { if (_context.ActionLink.Any(r => r.Name == action.Name)) { continue; } _context.ActionLink.Add(action); } _context.SaveChanges(); }