Пример #1
0
        public IActionResult ConvertTo([FromRoute] ConvertInputRequestModel request)
        {
            var converter = _converterFactory.Create(request.ConverterType);

            if (converter == null)
            {
                return(BadRequest());
            }

            try
            {
                var byteArr = _toByteArrayConverter.Convert(request.Input);
                var result  = converter.Convert(byteArr);
                return(Ok(result));
            }
            finally
            {
                _converterFactory.Release(converter);
            }
        }