public static void SeedData(LionsContext _context)
        {
            _context.Database.EnsureCreated();

            if (_context.Users.Any())
            {
                return;
            }

            var Users = new ApplicationUser[]
            {
                new ApplicationUser
                {
                    FirstName = "Anish",
                    LastName  = "Manandhar",
                    Email     = "*****@*****.**",
                    Password  = Crypto.HashPassword("password"),
                    Role      = "Admin",
                    Gender    = "Male",
                    ImageUrl  = "/upload/img/default.png"
                },
                new ApplicationUser
                {
                    FirstName = "Krishna",
                    LastName  = "Paudel",
                    Email     = "*****@*****.**",
                    Password  = Crypto.HashPassword("password"),
                    Role      = "User",
                    Gender    = "Male",
                    ImageUrl  = "/upload/img/default.png"
                },
                new ApplicationUser
                {
                    FirstName = "Brianne",
                    LastName  = "Vigeant",
                    Email     = "*****@*****.**",
                    Password  = Crypto.HashPassword("password"),
                    Role      = "User",
                    Gender    = "Female",
                    ImageUrl  = "/upload/img/female.png"
                }
            };

            foreach (ApplicationUser u in Users)
            {
                _context.Users.Add(u);
            }
            _context.SaveChanges();
        }
示例#2
0
        public static void SeedData(LionsContext _context)
        {
            _context.Database.EnsureCreated();

            if (_context.Users.Any())
            {
                return;
            }

            var Users = new ApplicationUser[]
            {
                new ApplicationUser
                {
                    FirstName = "Nishma",
                    LastName  = "Maskey",
                    Email     = "*****@*****.**",
                    Password  = Crypto.HashPassword("password"),
                    Role      = "Admin",
                    Gender    = "Female",
                    ImageUrl  = "~/upload/img/default.png"
                },
                new ApplicationUser
                {
                    FirstName = "Saugat",
                    LastName  = "Thapa",
                    Email     = "*****@*****.**",
                    Password  = Crypto.HashPassword("password"),
                    Role      = "User",
                    Gender    = "Male",
                    ImageUrl  = "~/upload/img/default.png"
                }
            };

            foreach (ApplicationUser u in Users)
            {
                _context.Users.Add(u);
            }
            _context.SaveChanges();
        }