示例#1
0
文件: Seed.cs 项目: Din-esh-g/H2HAPI
        public static void SeedUser(NewProjectAPIContext context)
        {
            if (!context.Users.Any())
            {
                var userData = System.IO.File.ReadAllText("Repo/UserSeedData.json");
                var users    = JsonConvert.DeserializeObject <List <Users> >(userData);
                foreach (var user in users)
                {
                    byte[] passwordhash, passwordSalt;
                    CreatePasswordHash("password", out passwordhash, out passwordSalt);
                    user.HashPassword = passwordhash;
                    user.PasswordSalt = passwordSalt;
                    user.Username     = user.Username.ToLower();
                    context.Add(user);
                }

                context.SaveChanges();
            }
        }
示例#2
0
 public DatingRepo(NewProjectAPIContext context)
 {
     _context = context;
 }
示例#3
0
 public NewsController(NewProjectAPIContext context)
 {
     _context = context;
 }
示例#4
0
 public AuthRepo(NewProjectAPIContext context)
 {
     _context = context;
 }
示例#5
0
 public UsersController(IDatingRepo repo, IMapper mapper, NewProjectAPIContext context)
 {
     _repo    = repo;
     _mapper  = mapper;
     _context = context;
 }
示例#6
0
 public MyJobRepocs(NewProjectAPIContext context)
 {
     _context = context;
 }
示例#7
0
 public PropertiesController(NewProjectAPIContext context)
 {
     _context = context;
 }
 public PropertiesController(NewProjectAPIContext context, IMapper mapper)
 {
     _context = context;
     _mapper  = mapper;
 }