Example #1
0
        private string GetTimelineData(HttpContext context)
        {
            try
            {
                JavaScriptSerializer serializer = new JavaScriptSerializer();

                TimelineParams inputParams = new TimelineParams();

                if (context.Request.Params["inputParameters"] != null)
                {
                    string jsonInput = HttpUtility.HtmlDecode(context.Request.Params["inputParameters"]);
                    inputParams = serializer.Deserialize <TimelineParams>(jsonInput);
                }

                if (string.IsNullOrEmpty(inputParams.ListName))
                {
                    return(serializer.Serialize(TimelineHelper.GetUserTimeline(inputParams)));
                }
                else
                {
                    return(serializer.Serialize(TimelineHelper.GetList(inputParams)));
                }
            }
            catch (Exception ex)
            {
                context.Response.StatusCode = 500;
                return(string.Format("Error retrieving timeline: '{0}'", ex.Message));
            }
        }