refactor: update sidebar component to use ViewComponent and improve layout structure
This commit is contained in:
21
Webzine.WebApplication/Components/Sidebar/Default.cs
Normal file
21
Webzine.WebApplication/Components/Sidebar/Default.cs
Normal file
@@ -0,0 +1,21 @@
|
||||
using Microsoft.AspNetCore.Mvc;
|
||||
using Webzine.Repository.Contracts;
|
||||
|
||||
namespace Webzine.Components
|
||||
{
|
||||
public class SidebarViewComponent : ViewComponent
|
||||
{
|
||||
private readonly IStyleRepository styleRepository;
|
||||
|
||||
public SidebarViewComponent(IStyleRepository styleRepository)
|
||||
{
|
||||
this.styleRepository = styleRepository;
|
||||
}
|
||||
|
||||
public IViewComponentResult Invoke()
|
||||
{
|
||||
var styles = this.styleRepository.FindAll();
|
||||
return this.View(styles);
|
||||
}
|
||||
}
|
||||
}
|
||||
Reference in New Issue
Block a user