using Microsoft.AspNet.Mvc; using Microsoft.Extensions.Localization; using Microsoft.Extensions.Logging; using Yavsc.Interfaces; using Yavsc.Models; namespace Yavsc.ViewComponents { public class TaggerViewComponent : ViewComponent { ApplicationDbContext dbContext; IStringLocalizer localizer; ILogger logger ; public TaggerViewComponent( ApplicationDbContext pdbContext, IStringLocalizer pLocalizer, ILoggerFactory loggerFactory) { dbContext = pdbContext; this.localizer = pLocalizer; this.logger = loggerFactory.CreateLogger(); } public IViewComponentResult Invoke(ITaggable longTaggable) { ViewData["Tags"] = longTaggable.GetTags(); ViewData["at"] = localizer["at"]; ViewData["apictlr"] = "~/api/"+localizer["apiRouteTag"+longTaggable.GetType().Name]; return View(longTaggable); } } }