public ActionResult GetItemByIdSpecial(string id) { XElement res = SObjects.GetItemByIdSpecial(id); return(new ContentResult { ContentType = "text/xml", Content = res.ToString() }); }
public PortraitSpecialModel(string id) { DateTime tt0 = DateTime.Now; XElement record = SObjects.GetItemByIdSpecial(id); if (record == null) { return; } this.id = record.Attribute("id").Value; string type_id = record.Attribute("type") == null ? "notype" : record.Attribute("type").Value; this.type_id = type_id; this.type = ModelCommon.OntNames.Where(pair => pair.Key == type_id).Select(pair => pair.Value).FirstOrDefault(); if (this.type == null) { this.type = type_id; } var name_el = record.Elements("field").Where(f => f.Attribute("prop").Value == "http://fogid.net/o/name") .FirstOrDefault(); this.name = name_el == null ? "noname" : name_el.Value; farr = record.Elements("field") .Select(el => new Field() { prop = el.Attribute("prop").Value, value = el.Value, lang = el.Attribute(ONames.xmllang)?.Value }) .ToArray(); darr = record.Elements("direct") .Select(el => new Direct() { prop = el.Attribute("prop").Value, resource = el.Element("record").Attribute("id").Value }) .ToArray(); iarr = record.Elements("inverse") .Select(el => new Inverse() { prop = el.Attribute("prop").Value, about = el.Element("record").Attribute("id").Value }) .ToArray(); duration = DateTime.Now - tt0; }