public IActionResult Get(string sort = null, string where = null, SupportedFormatType formatType = SupportedFormatType.XML) { var items = _currencyService.Get(sort, where); var sfm = new SupportedFormatManager(items, formatType); var result = sfm.GetResultAsBytes(); return(File(result, getContentType(formatType))); //return Ok(items); }
private string getContentType(SupportedFormatType type) { switch (type) { case SupportedFormatType.XML: return("text/xml"); case SupportedFormatType.CSV: return("text/csv"); default: throw new NotImplementedException(); } }
public SupportedFormatManager(List <Services.Models.Currency> currencies, SupportedFormatType type) { switch (type) { case SupportedFormatType.XML: format = new XmlFormat(currencies); break; case SupportedFormatType.CSV: format = new CsvFormat(currencies); break; default: throw new NotImplementedException(); } }
public IActionResult Get(string sort = null, string where = null, SupportedFormatType formatType = SupportedFormatType.XML) { var result = new CommonResponse(); return(Ok(result));; }