public static bool UpdatePassword(string password, int userId, out string errorMessage)
{
errorMessage = null;
try
{
using (SqlConnection connection = ConnectionManager.GetConnection())
{
var data = new ActivEarthDataProvidersDataContext(connection);
var user = (from u in data.UserDataProviders
where u.id == userId
select u).FirstOrDefault();
if (user != null)
{
user.password = password;
data.SubmitChanges();
return true;
}
return false;
}
}
catch (Exception e)
{
errorMessage = e.ToString();
return false;
}
}