コード例 #1
0
        public HttpResponseMessage Get(Guid id)
        {
            var record = db.Load <Record>(id);

            var xml    = new XmlEncoder().Create(record.Id, record.Gemini);
            var result = new HttpResponseMessage(HttpStatusCode.OK)
            {
                Content = new StringContent(xml.ToString())
            };

            result.Content.Headers.ContentDisposition = new ContentDispositionHeaderValue("attachment")
            {
                FileName = "topcat-record-" + record.Id.ToString().ToLower() + ".xml"
            };
            result.Content.Headers.ContentType = new MediaTypeHeaderValue("application/xml");

            return(result);
        }
コード例 #2
0
        public HttpResponseMessage Get(string id)
        {
            var record = db.Load <Record>(Helpers.AddCollection(id));

            record = Helpers.RemoveCollectionFromId(record);
            var resources = Helpers.GetOnlineResourcesFromDataResources(record);

            var xml    = new XmlEncoder().Create(record.Id, record.Gemini, resources);
            var result = new HttpResponseMessage(HttpStatusCode.OK)
            {
                Content = new StringContent(xml.ToString())
            };

            result.Content.Headers.ContentDisposition = new ContentDispositionHeaderValue("attachment")
            {
                FileName = "topcat-record-" + record.Id.ToLower() + ".xml"
            };
            result.Content.Headers.ContentType = new MediaTypeHeaderValue("application/xml");

            return(result);
        }