public static int UpdateFavorite(int favoriteId, string tags, string remark) { FavoriteDao favoriteDao = new FavoriteDao(); string text = ""; string[] array = null; array = ((!tags.Contains(",")) ? new string[1] { tags } : tags.Split(',')); string[] array2 = array; foreach (string text2 in array2) { if (!string.IsNullOrEmpty(DataHelper.CleanSearchString(text2.Trim()))) { favoriteDao.UpdateOrAddFavoriteTags(text2.Trim(), HiContext.Current.UserId); string text3 = tags.Replace(text2, ""); int num = (tags.Length - text3.Length) / text2.Length; if (num == 1 || !text.Contains(text2)) { text = text + DataHelper.CleanSearchString(text2) + ","; } } } if (!string.IsNullOrEmpty(text)) { text = text.Substring(0, text.Length - 1); } return(new FavoriteDao().UpdateFavorite(favoriteId, tags, remark)); }
public static int UpdateFavorite(int favoriteId, string tags, string remark) { FavoriteDao favoriteDao = new FavoriteDao(); string text = ""; string[] array; if (tags.Contains(",")) { array = tags.Split(new char[] { ',' }); } else { array = new string[] { tags }; } string[] array2 = array; for (int i = 0; i < array2.Length; i++) { string text2 = array2[i]; if (!string.IsNullOrEmpty(DataHelper.CleanSearchString(text2.Trim()))) { favoriteDao.UpdateOrAddFavoriteTags(text2.Trim()); string text3 = tags.Replace(text2, ""); int num = (tags.Length - text3.Length) / text2.Length; if (num == 1 || !text.Contains(text2)) { text = text + DataHelper.CleanSearchString(text2) + ","; } } } if (!string.IsNullOrEmpty(text)) { text = text.Substring(0, text.Length - 1); } return(new FavoriteDao().UpdateFavorite(favoriteId, tags, remark)); }