Add basic blog repo and models to test potential project structure

This commit is contained in:
Robert Marshall 2019-04-14 10:25:52 +01:00
parent 7703f9d8bb
commit 19c3c49f4d
10 changed files with 91 additions and 3 deletions

View 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);
}
}
}

View file

@ -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
{