public static IApplicationBuilder UseDatabasePageRedner(this IApplicationBuilder app) { app.Use(async(ctx, next) => { var route = ctx.Request.Path; dynamicPageBusiness = ctx.RequestServices.GetService <DynamicPageBusiness>(); var pageString = await GenericPage(route); if (!string.IsNullOrEmpty(pageString)) { var strBuffer = Encoding.UTF8.GetBytes(pageString); await ctx.Response.Body.WriteAsync(strBuffer, 0, strBuffer.Length); ctx.Response.ContentType = "text/html"; ctx.Response.StatusCode = 200; } else { await next(); } }); return(app); }
public DynamicRouteController(DynamicPageBusiness _dynamicPageBusiness) { dynamicPageBusiness = _dynamicPageBusiness; }