Beispiel #1
0
        async Task RenderPartialViewAsync(
            TextWriter writer,
            object model,
            ViewDataDictionary viewData,
            Microsoft.AspNetCore.Mvc.ViewEngines.IView view)
        {
            // Determine which ViewData we should use to construct a new ViewData
            var baseViewData       = viewData ?? ViewContext.ViewData;
            var newViewData        = new ViewDataDictionary <object>(baseViewData, model);
            var partialViewContext = new ViewContext(ViewContext, view, newViewData, writer);

            using (view as IDisposable)
            {
                await view.RenderAsync(partialViewContext);
            }
        }
Beispiel #2
0
        async Task RenderPartialViewAsync(
            TextWriter writer,
            object model,
            ViewDataDictionary viewData,
            Microsoft.AspNetCore.Mvc.ViewEngines.IView view)
        {
            var viewContext = new ViewContext(
                ViewContext,
                view,
                new ViewDataDictionary <object>(viewData ?? ViewContext.ViewData, model),
                writer);

            using (view as IDisposable)
            {
                await view.RenderAsync(viewContext);
            }
        }