18 lines
No EOL
443 B
C#
18 lines
No EOL
443 B
C#
using System.Threading.Tasks;
|
|
using Microsoft.AspNetCore.Mvc;
|
|
using Website.Data;
|
|
|
|
namespace Website.ViewComponents {
|
|
public class BlogNavigationViewComponent:ViewComponent {
|
|
private readonly BlogRepository _repo;
|
|
|
|
public BlogNavigationViewComponent(BlogRepository repo) {
|
|
_repo = repo;
|
|
}
|
|
|
|
public async Task<IViewComponentResult> InvokeAsync() {
|
|
var posts = await _repo.GetLatestPostsAsync(5);
|
|
return View(posts);
|
|
}
|
|
}
|
|
} |