Exemple #1
0
        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();
            }
        }
Exemple #2
0
 public DatingRepo(NewProjectAPIContext context)
 {
     _context = context;
 }
Exemple #3
0
 public NewsController(NewProjectAPIContext context)
 {
     _context = context;
 }
Exemple #4
0
 public AuthRepo(NewProjectAPIContext context)
 {
     _context = context;
 }
 public UsersController(IDatingRepo repo, IMapper mapper, NewProjectAPIContext context)
 {
     _repo    = repo;
     _mapper  = mapper;
     _context = context;
 }
Exemple #6
0
 public MyJobRepocs(NewProjectAPIContext context)
 {
     _context = context;
 }
 public PropertiesController(NewProjectAPIContext context)
 {
     _context = context;
 }
 public PropertiesController(NewProjectAPIContext context, IMapper mapper)
 {
     _context = context;
     _mapper  = mapper;
 }