public SimpleResponse SetDefaultAvatar(string accountId, string avatarId) { mServiceLog.Log.InfoFormat("SetDefaultAvatar: accountId={0}", accountId); AvatarUtil avatarUtil = new AvatarUtil(); avatarUtil.SetAllUserAvatarsToNotBeDefault(accountId); StringBuilder xmlBuilder = new StringBuilder(); try { using (MySqlConnection mysqlConnection = new MySqlConnection(WebConfig.AvatarsDBConnectionString)) { mysqlConnection.Open(); string getDefaultAvatarQuery = "UPDATE AccountToAvatarMapping SET IsDefault = '1' WHERE AvatarId=@AvatarId;"; using (MySqlCommand getDefaultAvatarCommand = mysqlConnection.CreateCommand()) { getDefaultAvatarCommand.Parameters.AddWithValue("@AvatarId", avatarId); getDefaultAvatarCommand.CommandText = getDefaultAvatarQuery; getDefaultAvatarCommand.ExecuteNonQuery(); } } } catch (System.Exception ex) { throw ex; } return(GetAvatars(null, null, avatarId, null, null)); }
public SimpleResponse EnableAvatar(string avatarId) { mServiceLog.Log.InfoFormat("EnableAvatar: avatarId={0}", avatarId); AvatarUtil avatarUtil = new AvatarUtil(); avatarUtil.EnableAvatar(avatarId); return(GetAvatars(null, null, avatarId, null, null)); }
public SimpleResponse DeleteAvatar(string avatarId) { mServiceLog.Log.InfoFormat("DeleteAvatar: avatarId={0}", avatarId); AvatarUtil avatarUtil = new AvatarUtil(); avatarUtil.DeleteAvatar(avatarId); return(new SimpleResponse("Success", "true")); }