Exemplo n.º 1
0
 public MessageRepository(ILogger <MessageRepository> logger, DatingDbContext context, IMapper mapper, IUserRepository userManager)
 {
     this._logger      = logger;
     this._context     = context;
     this._mapper      = mapper;
     this._userManager = userManager;
 }
Exemplo n.º 2
0
 public PhotoRepository(IOptions <CloudinarySettings> cloudinarySettingOptions, DatingDbContext context, IMapper mapper, ILogger <PhotoRepository> logger)
 {
     this._cloudinarySettings = cloudinarySettingOptions.Value;
     this._context            = context;
     this._mapper             = mapper;
     this._logger             = logger;
 }
Exemplo n.º 3
0
 public UserLoginTest(TestFixture <Startup> fixture)
 {
     _fixture       = fixture;
     _context       = _fixture.CreateDbContext();
     _mapper        = (IMapper)_fixture.Server.Host.Services.GetService(typeof(IMapper));
     _configuration = (IConfiguration)_fixture.Server.Host.Services.GetService(typeof(IConfiguration));
 }
Exemplo n.º 4
0
        public void Migrate(DatingDbContext context, ILogger <Program> logger)
        {
            logger.LogInformation("Database migration started!");

            context.Database.Migrate();

            logger.LogInformation("Database migration completed!");
        }
Exemplo n.º 5
0
        public DatingDbContext CreateDbContext()
        {
            var options = new DbContextOptionsBuilder <DatingDbContext>()
                          .UseInMemoryDatabase(databaseName: Guid.NewGuid().ToString())
                          .Options;

            var dbContext = new DatingDbContext(options);

            return(dbContext);
        }
Exemplo n.º 6
0
 public userRepository(
     DatingDbContext context,
     IMapper mapper,
     ILogger <userRepository> logger,
     UserManager <User> userManager,
     SignInManager <User> signInManager,
     IAuthorization authorization)
 {
     this._signInManager = signInManager;
     this._context       = context;
     this._mapper        = mapper;
     this._logger        = logger;
     this._userManager   = userManager;
     this._authorization = authorization;
 }
Exemplo n.º 7
0
 public static void SeedUsers(DatingDbContext datingDbContext)
 {
     if (!datingDbContext.Users.Any())
     {
         var userData = System.IO.File.ReadAllText("../DatingApp.Data/SeedData/UserSeedData.json");
         var users    = JsonConvert.DeserializeObject <List <User> >(userData);
         foreach (var user in users)
         {
             CreatePasswordHash("password", out byte[] passwordSalt, out byte[] passwordHash);
             user.PasswordHash = passwordHash;
             user.PasswordSalt = passwordSalt;
             user.Username     = user.Username.ToLower();
         }
         datingDbContext.AddRange(users);
         datingDbContext.SaveChanges();
     }
 }
Exemplo n.º 8
0
        public static async Task SeedUser(DatingDbContext context)
        {
            if (await context.Users.AnyAsync())
            {
                return;
            }

            var userData = await File.ReadAllTextAsync("Data/UserSeedData.json");

            var users = JsonSerializer.Deserialize <List <AppUser> >(userData);

            users?.ForEach(item =>
            {
                using var hmac    = new HMACSHA512();
                item.UserName     = item.UserName.ToLower();
                item.PasswordHash = hmac.ComputeHash(Encoding.UTF8.GetBytes("Pa$$w0rd"));
                item.PasswordSalt = hmac.Key;
                context.Users.Add(item);
            });

            await context.SaveChangesAsync();
        }
Exemplo n.º 9
0
 public AuthRepository(DatingDbContext context)
 {
     _context = context;
 }
Exemplo n.º 10
0
 public ValuesDAL(DatingDbContext context)
 {
     _context = context;
 }
Exemplo n.º 11
0
 public ValuesController(DatingDbContext context)
 {
     _context = context;
 }
Exemplo n.º 12
0
 /// <summary>
 ///
 /// </summary>
 public UserRepository(DatingDbContext context, IMapper mapper)
 {
     this.context = context;
     this.mapper  = mapper;
 }
Exemplo n.º 13
0
 public ProfileController(DatingDbContext context, IWebHostEnvironment hostEnvironment)
 {
     _context         = context;
     _hostEnvironment = hostEnvironment;
 }
Exemplo n.º 14
0
 public AuthRepository(DatingDbContext datingDbContext)
 {
     _datingDbContext = datingDbContext;
 }