public void Reconnect(string login, string password) { if (context != null) { context.Dispose(); } string connectionString = String.Format("Server=127.0.0.1;Port=5432;Database=Bets;User Id={0};Password={1};", login, password); context = new SportBetDbContext(connectionString); }
public string GetPassword() { string password = null; SportBetDbContext context = GetContext(); AdminPasswordEntity adminPasswordEntity = context.AdminPassword.SingleOrDefault(); if (adminPasswordEntity != null) { password = adminPasswordEntity.Value; } return(password); }
public void SetPassword(string value) { SportBetDbContext context = GetContext(); AdminPasswordEntity adminPasswordEntity = context.AdminPassword.SingleOrDefault(); if (adminPasswordEntity != null) { adminPasswordEntity.Value = value; } else { adminPasswordEntity = new AdminPasswordEntity { Value = value }; context.AdminPassword.Add(adminPasswordEntity); } }
public UnitOfWork() { this.context = new SportBetDbContext(); }