protected override void Dispose(bool disposing) { if (disposing) { db.Dispose(); } base.Dispose(disposing); }
public static User GetUserByCredentials(string login, string password) { using (WebAPIDBContext entities = new WebAPIDBContext()) { var result = entities.Users.FirstOrDefault(user => user.Login.Equals(login, StringComparison.OrdinalIgnoreCase) && user.Password == password); entities.Dispose(); return(result); } }
public static bool Login(string login, string password) { using (WebAPIDBContext entities = new WebAPIDBContext()) { var result = entities.Users.Any(user => user.Login.Equals(login, StringComparison.OrdinalIgnoreCase) && user.Password == password); entities.Dispose(); return(result); } }
public void Dispose() { _entities.Dispose(); }