예제 #1
0
        public void Seed()
        {
            var initialUsers = new List <Users>
            {
                new Users
                {
                    Id       = 1,
                    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();
        }
예제 #2
0
        public void Seed()
        {
            var initialActionLinks = new List <ActionLinks>
            {
                new ActionLinks
                {
                    Id         = 1,
                    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();
        }