private static HLinkPlaceNameModelCollection GetPlaceNameModelCollection(XElement xmlData) { HLinkPlaceNameModelCollection t = new HLinkPlaceNameModelCollection { Title = "Place Name Collection" }; // Run query IEnumerable <XElement> theERElement = from orElementEl in xmlData.Elements(ns + "pname") select orElementEl; if (theERElement.Any()) { // Load attribute object references foreach (XElement theLoadORElement in theERElement) { PlaceNameModel newPlaceNameModel = new PlaceNameModel { GValue = GetAttribute(theLoadORElement, "value"), GLang = GetAttribute(theLoadORElement, "lang"), GDate = GetDate(theLoadORElement), }; newPlaceNameModel.ModelItemGlyph.Symbol = Constants.IconPlace; newPlaceNameModel.HLinkKey = HLinkKey.NewAsGUID(); HLinkPlaceNameModel tt = new HLinkPlaceNameModel { DeRef = newPlaceNameModel }; if (string.IsNullOrEmpty(newPlaceNameModel.GValue)) { } t.Add(tt); } } return(t); }
private PlaceNameModelCollection GetPlaceNameModelCollection(XElement xmlData) { PlaceNameModelCollection t = new PlaceNameModelCollection(); // Run query var theERElement = from orElementEl in xmlData.Elements(ns + "pname") select orElementEl; if (theERElement.Any()) { // Load attribute object references foreach (XElement theLoadORElement in theERElement) { PlaceNameModel newAttributeModel = new PlaceNameModel { Handle = "PlaceNameModel", GValue = (string)theLoadORElement.Attribute("value"), GLang = (string)theLoadORElement.Attribute("lang"), GDate = GetDate(theLoadORElement), }; newAttributeModel.HomeImageHLink.HomeSymbol = CommonConstants.IconPlace; t.Add(newAttributeModel); } } // Return sorted by the default text t.Sort(T => T.DeRef.GetDefaultText); return(t); }