in the tube: a blog index as component

vnext
Paul Schneider 6 years ago
parent 5d378da97a
commit 8db5b4dcbc
1 changed files with 34 additions and 0 deletions

@ -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<ApplicationUser> userManager,
ILoggerFactory loggerFactory,
IAuthorizationService authorizationService,
IOptions<SiteSettings> siteSettings)
{
_context = context;
_logger = loggerFactory.CreateLogger<BlogIndexViewComponent>();
_authorizationService = authorizationService;
}
// Renders blog index ofr the specified user by name
public async Task<IViewComponentResult> InvokeAsync(string userName)
{
return View("Default");
}
}
}
Loading…