website/Website/ViewComponents/ProjectNavigationViewComponent.cs

19 lines
No EOL
472 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 IGitApi _api;
public ProjectNavigationViewComponent(IGitApi api) {
_api = api;
}
public async Task<IViewComponentResult> InvokeAsync() {
var repositories = await _api.GetRepositories("rob");
return View(repositories.Take(5));
}
}
}