public bool UpdateCityAndCountry(Guid id, string newCity, string newCountry)
{
var queryString =
"UPDATE [dbo].[accounts] " +
"SET [country] = @country" +
", [city] = @city " +
"WHERE [dbo].accounts.accountid = @accountid";
using (SqlConnection connection = new SqlConnection(_connectionString))
{
var command = new SqlCommand(queryString, connection);
command.Parameters.AddWithValue("country", newCountry);
command.Parameters.AddWithValue("city", newCity);
command.Parameters.AddWithValue("accountid", id);
try
{
connection.Open();
command.ExecuteNonQuery();
}
catch (Exception)
{
throw;
}
return true;
}
}