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);
        }
Exemplo n.º 2
0
        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();
            }
        }
Exemplo n.º 4
0
        public IActionResult Get(string sort = null, string where = null, SupportedFormatType formatType = SupportedFormatType.XML)
        {
            var result = new CommonResponse();

            return(Ok(result));;
        }