public void ProcessRequest(HttpContext context)
        {
            //validate query parameters
            QueryParams queryParams;

            try
            {
                queryParams = new QueryParams(context.Request);
            }
            catch
            {
                context.Response.StatusCode = 400; //bad request
                return;
            }

            //convert query parameters to entities
            var ctx          = new DiscCtx(ConfigManager.ConnStr);
            var reportParams = queryParams.Materialize(ctx);

            if (reportParams == null)
            {
                context.Response.StatusCode = 400;
                return;
            }

            //compute and set report parameters
            var report = new MediaReport
            {
                ReportParams = reportParams,
                BaseUrl      = Helpers.BaseUrl(context.Request)
            };

            context.Response.Write(report.TransformText());
        }
        public void ProcessRequest(HttpContext context)
        {
            //validate query parameters
            QueryParams queryParams;
            try
            {
                queryParams = new QueryParams(context.Request);
            }
            catch
            {
                context.Response.StatusCode = 400; //bad request
                return;
            }

            //convert query parameters to entities            
            var ctx = new DiscCtx(ConfigManager.ConnStr);
            var reportParams = queryParams.Materialize(ctx);
            if (reportParams == null)
            {
                context.Response.StatusCode = 400;
                return;
            }
            
            //compute and set report parameters 
            var report = new MediaReport
                {
                    ReportParams = reportParams,
                    BaseUrl = Helpers.BaseUrl(context.Request)
                };

           context.Response.Write(report.TransformText());
        }