Test home controller
This commit is contained in:
parent
af4e217e69
commit
2d43452fa5
3 changed files with 42 additions and 7 deletions
|
@ -8,18 +8,18 @@ using Website.ViewModels.Blog;
|
|||
namespace Website.Controllers {
|
||||
public class HomeController : Controller {
|
||||
private readonly IBlogApi _blogApi;
|
||||
private readonly IGitApi _api;
|
||||
private readonly IGitApi _gitApi;
|
||||
|
||||
public HomeController(IBlogApi blogApi, IGitApi api) {
|
||||
_api = api;
|
||||
public HomeController(IBlogApi blogApi, IGitApi gitApi) {
|
||||
_gitApi = gitApi;
|
||||
_blogApi = blogApi;
|
||||
}
|
||||
|
||||
public async Task<IActionResult> Index() {
|
||||
var post = await _blogApi.GetLatestPostAsync();
|
||||
var repo = (await _api.GetRepositories("rob")).First();
|
||||
var branch = (await _api.GetBranches("rob", repo.Name)).First();
|
||||
var commit = await _api.GetCommit("rob", repo.Name, branch.Commit.Id);
|
||||
var repo = (await _gitApi.GetRepositories("rob")).First();
|
||||
var branch = (await _gitApi.GetBranches("rob", repo.Name)).First();
|
||||
var commit = await _gitApi.GetCommit("rob", repo.Name, branch.Commit.Id);
|
||||
|
||||
var model = new HomeViewModel {
|
||||
BlogPost = new BlogPostViewModel(post, false),
|
||||
|
|
|
@ -3,6 +3,6 @@ using Website.ViewModels.Blog;
|
|||
namespace Website.ViewModels {
|
||||
public class HomeViewModel {
|
||||
public BlogPostViewModel BlogPost { get; set; }
|
||||
public GitCommitViewModel GitCommit { get; internal set; }
|
||||
public GitCommitViewModel GitCommit { get; set; }
|
||||
}
|
||||
}
|
Loading…
Add table
Add a link
Reference in a new issue