Add BlogPostViewModel for view specific processing
This commit is contained in:
parent
647696aa92
commit
dda522d221
6 changed files with 34 additions and 18 deletions
|
@ -26,7 +26,8 @@ namespace Website.Controllers
|
|||
public async Task<IActionResult> View(int id)
|
||||
{
|
||||
var post = await _repo.GetPostAsync(id);
|
||||
return View(post);
|
||||
var model = new BlogPostViewModel(post);
|
||||
return View(model);
|
||||
}
|
||||
}
|
||||
}
|
||||
|
|
|
@ -18,7 +18,8 @@ namespace Website.Controllers
|
|||
public async Task<IActionResult> Index()
|
||||
{
|
||||
var post = await _blogRepo.GetLatestPostAsync();
|
||||
return View(post);
|
||||
var model = new BlogPostViewModel(post);
|
||||
return View(model);
|
||||
}
|
||||
}
|
||||
}
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue