public override string GetRawDataString(object model) { string renderedView = string.Empty; var view = model as View; if (view != null) { string extensionName = System.IO.Path.GetExtension(view.Path); IViewEngine viewEngine = ViewEngineFactory.GetViewEngine(extensionName); try { renderedView = viewEngine.RenderView(_context, view.Path, view.Model, view.ViewBag); } catch (Exception ex) { throw ex; } return(renderedView); } else { _context.Response.Status = Status.Is.NotFound; return(model != null?model.ToString() : ""); } }
private static Response SafeInvokeViewEngine(IViewEngine viewEngine, ViewLocationResult locationResult, dynamic model, IRenderContext renderContext) { try { return(viewEngine.RenderView(locationResult, model, renderContext)); } catch (Exception) { return(EmptyView); } }
private static Action <Stream> SafeInvokeViewEngine(IViewEngine viewEngine, ViewLocationResult locationResult, dynamic model) { try { return(viewEngine.RenderView(locationResult, model)); } catch (Exception) { return(NullView); } }
private static Action <Stream> InvokeViewEngine(IViewEngine viewEngine, ViewLocation viewLocation, dynamic model) { try { return(viewEngine.RenderView(viewLocation, model)); } catch (Exception) { return(stream => { }); } }
private static Action<Stream> SafeInvokeViewEngine(IViewEngine viewEngine, ViewLocationResult locationResult, dynamic model) { try { return viewEngine.RenderView(locationResult, model); } catch (Exception) { return EmptyView; } }
private static Response SafeInvokeViewEngine(IViewEngine viewEngine, ViewLocationResult locationResult, dynamic model, IRenderContext renderContext) { try { return viewEngine.RenderView(locationResult, model, renderContext); } catch (Exception) { return EmptyView; } }
protected override void InternalFillResponse(HttpResponseBase response, HttpContextBase context) { var viewData = GetViewData(); _viewEngine.RenderView(viewData.ViewName, viewData.Data, response.OutputStream); }