using System;
using System.Collections.Generic;
using System.Linq;
using System.Web;
using System.IO;
using System.Net.Http;
using System.Net;
using edu.jhu.Cas.Util;
using System.Data.SqlClient;

namespace RestApi.Models
{
    public class CsvResponse
    {
        private ReaderObject qObject;
        public CsvResponse(ReaderObject qObject) 
        {
            this.qObject = qObject;
        }

        public void WriteToStream(Stream outputStream, HttpContent content, TransportContext context)
        {
            try
            {
                DataConverter.reader2CSVStream(qObject.Results.Reader, outputStream);
            }
            finally
            {
                qObject.CloseConnection();
            }
        }
    }
}