public async Task <bool> AddItem(T item) { var className = item.GetType().FullName.Split('.').Last().ToLower(); string value = string.Empty; if (_contentType.EndsWith("json")) { value = JsonConvert.SerializeObject(item); } else { value = XmlHelper2 <T> .Save(item); } using (var content = new ByteArrayContent(Encoding.UTF8.GetBytes(value))) { content.Headers.Add("Content-Type", _contentType); content.Headers.Add("Content-Length", value.Length.ToString()); var response = await _client.PostAsync(_baseUrl + className + "/add", content); return(response.IsSuccessStatusCode); } }
public async Task <string> Parse(Slide item) { var xml = XmlHelper2 <Slide> .Save(item); return(await _apiService.TransformXml(XElement.Load(new StringReader(xml)), "slide2markdown.xslt")); }
private Slide Clone(Slide source) { var xml = XmlHelper2 <Slide> .Save(source); return(XmlHelper2 <Slide> .LoadFromString(xml)); }