public bool IsValid(string username, string password, DynamicDb db) { byte[] bytes = Encoding.UTF8.GetBytes(password); SHA256Managed hashstring = new SHA256Managed(); byte[] hash = hashstring.ComputeHash(bytes); string hashString = string.Empty; foreach (byte x in hash) { hashString += String.Format("{0:x2}", x); } try { return db.RunListProcedure<Composites.User>("[LoginUser]", new { username = username, password = hashString }).Any(); } catch (Exception) { return false; throw; } }