/// <summary> /// take response and save it's properties to a new row inside an in-memory DataTable /// </summary> /// <param name="response"></param> public static void LogRequest(this math.Models.MathResponse response) { lock (MvcApplication.RequestLog) { DataRow dr = MvcApplication.RequestLog.NewRow(); dr.ItemArray = response.ToItemArray(); MvcApplication.RequestLog.Rows.Add(dr); } }
public static void CaptureOrigin(this math.Models.MathResponse response, System.Web.Mvc.Controller c) { response.RequestOrigin = c.HttpContext.Request.UserHostAddress; }
/// <summary> /// [UserQuery, Response, RequestOrigin, RequestDateTime] /// </summary> /// <param name="response"></param> /// <returns></returns> public static Object[] ToItemArray(this math.Models.MathResponse response) { return(new Object[] { response.UserQuery, response.Response, response.RequestOrigin, response.RequestDateTime }); }