Add basic blog repo and models to test potential project structure
This commit is contained in:
parent
7703f9d8bb
commit
19c3c49f4d
10 changed files with 91 additions and 3 deletions
32
Website/Controllers/BlogController.cs
Normal file
32
Website/Controllers/BlogController.cs
Normal file
|
@ -0,0 +1,32 @@
|
|||
using System;
|
||||
using System.Collections.Generic;
|
||||
using System.Diagnostics;
|
||||
using System.Linq;
|
||||
using System.Threading.Tasks;
|
||||
using Microsoft.AspNetCore.Mvc;
|
||||
using Website.Data;
|
||||
using Website.ViewModels;
|
||||
|
||||
namespace Website.Controllers
|
||||
{
|
||||
public class BlogController : Controller
|
||||
{
|
||||
private readonly BlogRepository _repo;
|
||||
|
||||
public BlogController(BlogRepository repo)
|
||||
{
|
||||
_repo = repo;
|
||||
}
|
||||
|
||||
public IActionResult Index()
|
||||
{
|
||||
return View();
|
||||
}
|
||||
|
||||
public async Task<IActionResult> View(int id)
|
||||
{
|
||||
var post = await _repo.GetPost(id);
|
||||
return View(post);
|
||||
}
|
||||
}
|
||||
}
|
|
@ -4,7 +4,7 @@ using System.Diagnostics;
|
|||
using System.Linq;
|
||||
using System.Threading.Tasks;
|
||||
using Microsoft.AspNetCore.Mvc;
|
||||
using Website.Models;
|
||||
using Website.ViewModels;
|
||||
|
||||
namespace Website.Controllers
|
||||
{
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue