strong ressources and interface

This commit is contained in:
Paul Schneider 2019-06-17 20:52:51 +01:00
commit ddedb227b1
44 changed files with 2456 additions and 414 deletions

View file

@ -4,15 +4,17 @@ using Yavsc.Models.Blog;
namespace Yavsc.ViewComponents
{
public class CommentViewComponent : ViewComponent
public partial class CommentViewComponent : ViewComponent
{
IStringLocalizer<CommentViewComponent> localizer;
public CommentViewComponent(IStringLocalizer<CommentViewComponent> localizer)
{
this.localizer = localizer;
}
public IViewComponentResult Invoke(IIdentified<long> longCommentable)
{
// for a BlogPost, it results in the localization 'apiRouteCommentBlogPost': blogcomments
ViewData["apictlr"] = "/api/"+localizer["apiRouteComment"+longCommentable.GetType().Name];
return View(longCommentable.GetType().Name, new Comment{ PostId = longCommentable.Id });
}