/// <inheritdoc/> public void Render(ViewContext context, TextWriter writer) { if (context == null) { throw new ArgumentNullException(nameof(context)); } if (context.ViewData.Model is TModel m) { var html = _view.Render(m); html.Write(writer); return; } throw new InvalidOperationException($"Expected a model of type {typeof(TModel).Name} but the actual model is of type {context.ViewData.Model.GetType().Name}"); }
/// <inheritdoc/> public async Task RenderAsync(ViewContext context) { if (context == null) { throw new ArgumentNullException(nameof(context)); } if (context.ViewData.Model is TModel m) { var html = _view.Render(m); if (context.ViewData.TryGetValue("RenderAsync", out var renderAsync) && renderAsync is bool b && b) { await html.WriteAsync(context.Writer); return; } html.Write(context.Writer); return; } throw new InvalidOperationException($"Expected a model of type {typeof(TModel).Name} but the actual model is of type {context.ViewData.Model.GetType().Name}"); }
private async Task Render(SolutionConfiguration solutionConfiguration, SolutionList solutionList) { await _htmlRenderer.Render(solutionConfiguration, solutionList); }