private static List<TridionTcmUri> GetKeywordsSelectListItems(string selectedKeywords) { List<TridionTcmUri> list = new List<TridionTcmUri>(); if (selectedKeywords != null) { string[] strArray = selectedKeywords.Split(new char[] { ',' }); TridionTcmUri item = new TridionTcmUri(); foreach (string str in strArray) { item = UtilityHelper.GetTcmUri(str); list.Add(item); } } return list; }
private static List<SelectListItem> GetKeywordsSelectList(UserProfile model, IEnumerable<Coats.Crafts.Models.Keyword> keywords) { List<SelectListItem> list = new List<SelectListItem>(); List<int> list2 = new List<int>(); TridionTcmUri tcmUri = new TridionTcmUri(); foreach (KeyValuePair<string, string> pair in model.Keywords) { tcmUri = UtilityHelper.GetTcmUri(pair.Key); list2.Add(tcmUri.TcmItemId); } TridionTcmUri uri2 = new TridionTcmUri(); foreach (Coats.Crafts.Models.Keyword keyword in keywords) { uri2 = UtilityHelper.GetTcmUri(keyword.Id); list.Add(list2.Contains(uri2.TcmItemId) ? new SelectListItem() : new SelectListItem()); } return (from x in list orderby x.Text select x).ToList<SelectListItem>(); }