public bool UpdateAvatar(Guid accountId, byte[] Image, string mimeType)
{
var queryString =
"UPDATE [dbo].[accounts] " +
"SET [photo] = @photo " +
",[mimetype] = @mimetype " +
"WHERE [dbo].accounts.accountid = @accountid";
using (SqlConnection connection = new SqlConnection(_connectionString))
{
var command = new SqlCommand(queryString, connection);
command.Parameters.AddWithValue("photo", Image);
command.Parameters.AddWithValue("mimetype", mimeType);
command.Parameters.AddWithValue("accountid", accountId);
try
{
connection.Open();
command.ExecuteNonQuery();
}
catch (Exception)
{
throw;
}
return true;
}
}