示例#1
0
        public void Seed()
        {
            var initialSideBars = new List <SideBars>
            {
                new SideBars
                {
                    Name       = "班级管理",
                    Controller = "banji",
                    Action     = "Index"
                },
                new SideBars
                {
                    Name       = "教师管理",
                    Controller = "teachers",
                    Action     = "Index"
                },
                new SideBars
                {
                    Name       = "学生管理",
                    Controller = "Stdent",
                    Action     = "Index"
                },
                new SideBars
                {
                    Name       = "课程科目管理",
                    Controller = "subject",
                    Action     = "Index"
                },
                new SideBars
                {
                    Name       = "课程安排",
                    Controller = "kechenganpai",
                    Action     = "Index"
                },
                new SideBars
                {
                    Name       = "顶部导航栏管理",
                    Controller = "ActionLinks",
                    Action     = "Index"
                },
                new SideBars
                {
                    Name       = "左侧导航栏管理",
                    Controller = "SideBar",
                    Action     = "Index"
                }
            };

            foreach (var action in initialSideBars)
            {
                if (_context.SideBars.Any(r => r.Name == action.Name))
                {
                    continue;
                }
                _context.SideBars.Add(action);
            }
            _context.SaveChanges();
        }
示例#2
0
        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();
        }
示例#3
0
        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();
        }