protected string RenderHtml(string controller, string action, BeeDataAdapter dataAdapter) { string result = string.Empty; using (MemoryStream memoryStream = new MemoryStream()) { using (StreamWriter streamWriter = new StreamWriter(memoryStream, Encoding.UTF8)) { HttpWorkerRequest wr = new System.Web.Hosting.SimpleWorkerRequest("index.htm", string.Empty, streamWriter); HttpContext httpContext = new HttpContext(wr); httpContext.Response.ContentEncoding = Encoding.Default; MvcDispatcher.ExecuteAction(httpContext, controller, action, dataAdapter); httpContext.Response.Flush(); streamWriter.Flush(); memoryStream.Position = 0; //using (StreamReader reader = new StreamReader(memoryStream, Encoding.UTF8)) //{ // result = reader.ReadToEnd(); //} result = Encoding.UTF8.GetString(memoryStream.ToArray()); } } return(result); }
public void RenderAction(string controller, string action, params string[] data) { BeeDataAdapter dataAdapter = new BeeDataAdapter(); foreach (string item in data) { Match match = ExAttributeRegex.Match(item); if (match.Success) { dataAdapter[match.Groups["name"].Value] = match.Groups["value"].Value; } } MvcDispatcher.ExecuteAction(controller, action, dataAdapter); }
protected StreamResult OutputPage(string fileName, string controller, string action) { MemoryStream memoryStream = new MemoryStream(); StreamWriter streamWriter = new StreamWriter(memoryStream); HttpWorkerRequest wr = new System.Web.Hosting.SimpleWorkerRequest("index.htm", string.Empty, streamWriter); HttpContext httpContext = new HttpContext(wr); httpContext.Response.ContentEncoding = Encoding.Default; MvcDispatcher.ExecuteAction(httpContext, controller, action, ViewData); httpContext.Response.Flush(); streamWriter.Flush(); StreamResult streamResult = new StreamResult(fileName, memoryStream); return(streamResult); }
public void RenderAction(string controller, string action, BeeDataAdapter dataAdapter) { MvcDispatcher.ExecuteAction(controller, action, dataAdapter); }
public void RenderAction(string controller, string action) { MvcDispatcher.ExecuteAction(controller, action, null); }
protected void Invoke(string controllerName, string actionName, BeeDataAdapter dataAdapter) { MvcDispatcher.ExecuteAction(controllerName, actionName, dataAdapter); }