public GbstShowModel Execute(GbstShowRequest request) { var list = _listCache.GetGbstList(request.Name); var result = new GbstShowModel { Name = request.Name }; if (list == null) { return(result); } var defaultTitle = (list.DefaultElement != null) ? list.DefaultElement.Title : "n/a"; result.Elements = list.Elements .OrderBy(s => s.Rank) .Select(e => new ListElement { Id = e.ObjectID, Title = e.Title, Rank = e.Rank, IsActive = e.State != 1, IsDefault = e.Title == defaultTitle }).ToArray(); return(result); }
public IClarifyList GetList(string listName) { var gbstList = _listCache.GetGbstList(listName); if (gbstList == null) { throw new ApplicationException(String.Format("Gbst list {0} was not found in the list cache.", listName)); } var listElements = from GlobalStringElement element in gbstList.ActiveElements let isElementDefault = element.Equals(gbstList.DefaultElement) select new ClarifyListElement(element.Title, element.Rank, isElementDefault) { DatabaseIdentifier = element.ObjectID }; return(new ClarifyGlobalList(gbstList.Title, listElements.ToArray())); }