From 8db5b4dcbc13a3c23182a4e0e725dfcb45cc65bc Mon Sep 17 00:00:00 2001 From: Paul Schneider Date: Wed, 28 Nov 2018 13:57:26 +0000 Subject: [PATCH] in the tube: a blog index as component --- .../ViewComponents/BlogIndexViewComponent.cs | 34 +++++++++++++++++++ 1 file changed, 34 insertions(+) create mode 100644 Yavsc/ViewComponents/BlogIndexViewComponent.cs diff --git a/Yavsc/ViewComponents/BlogIndexViewComponent.cs b/Yavsc/ViewComponents/BlogIndexViewComponent.cs new file mode 100644 index 00000000..d4eaca09 --- /dev/null +++ b/Yavsc/ViewComponents/BlogIndexViewComponent.cs @@ -0,0 +1,34 @@ +using System.Threading.Tasks; +using Microsoft.AspNet.Mvc; +using Microsoft.AspNet.Identity; +using Microsoft.Extensions.Logging; +using Microsoft.AspNet.Authorization; +using Microsoft.Extensions.OptionsModel; +using Yavsc.Models; + +namespace Yavsc.ViewComponents +{ + public class BlogIndexViewComponent: ViewComponent + { + ILogger _logger; + private ApplicationDbContext _context; + private IAuthorizationService _authorizationService; + public BlogIndexViewComponent( + ApplicationDbContext context, + UserManager userManager, + ILoggerFactory loggerFactory, + IAuthorizationService authorizationService, + IOptions siteSettings) + { + _context = context; + _logger = loggerFactory.CreateLogger(); + _authorizationService = authorizationService; + } + + // Renders blog index ofr the specified user by name + public async Task InvokeAsync(string userName) + { + return View("Default"); + } + } +} \ No newline at end of file