public static string GetTile(this MemberInterestType interestType) { switch (interestType) { case MemberInterestType.General: return("Общее"); case MemberInterestType.Movie: return("Видео"); case MemberInterestType.TVShow: return("ТВШоу"); case MemberInterestType.Book: return("Книги"); case MemberInterestType.VideoGame: return("Игры"); default: return(string.Empty); } }
private IEnumerable <MemberInterest> GetInterestCollection(string interestsString, MemberInterestType type) { var interestsCollection = new Dictionary <string, MemberInterest>(); if (string.IsNullOrWhiteSpace(interestsString)) { return(interestsCollection.Values); } foreach (var interest in interestsString.Split(',')) { string key = interest.Trim().ToLower(); if (interestsCollection.ContainsKey(key)) { continue; } if (invalidInterestFormat.IsMatch(key) || key.Length > CONST_MaxInterestLength) { continue; } if (string.IsNullOrWhiteSpace(key)) { continue; } interestsCollection.Add(key, new MemberInterest { Title = interest.Trim(), Type = type }); } return(interestsCollection.Values); }