website/Website/ViewComponents/ProjectNavigationViewComponent.cs

19 lines
No EOL
477 B
C#

using System.Linq;
using System.Threading.Tasks;
using Microsoft.AspNetCore.Mvc;
using Website.Data;
namespace Website.ViewComponents {
public class ProjectNavigationViewComponent :ViewComponent {
private readonly GitServerApi _api;
public ProjectNavigationViewComponent(GitServerApi api) {
_api = api;
}
public async Task<IViewComponentResult> InvokeAsync() {
var repositories = await _api.GetRepositories();
return View(repositories.Take(5));
}
}
}