Former-commit-id: 7eb714d6d6601cad03f2e41f20645c3253b56f2d [formerly 4031c97f1237649aef5d81bd6ddbf26c5628ccd3] Former-commit-id: 69e35745942ae94fdbb7d9cc745942babaaf1fbe
39 lines
1.2 KiB
C#
39 lines
1.2 KiB
C#
using System;
|
|
using System.Collections.Generic;
|
|
using System.Diagnostics;
|
|
using System.Linq;
|
|
using System.Threading.Tasks;
|
|
using Microsoft.AspNetCore.Mvc;
|
|
using TerribleDev.Blog.Web.Models;
|
|
using System.IO;
|
|
|
|
namespace TerribleDev.Blog.Web.Controllers
|
|
{
|
|
public class HomeController : Controller
|
|
{
|
|
[Route("/")]
|
|
public IActionResult Index()
|
|
{
|
|
return View();
|
|
}
|
|
[Route("/theme/{*postName}")]
|
|
public IActionResult Theme(string postName)
|
|
{
|
|
return View(model: postName);
|
|
}
|
|
[Route("/{*postName}")]
|
|
public async Task<IActionResult> Post(string postName)
|
|
{
|
|
var post = await System.IO.File.ReadAllTextAsync(Path.Combine("Posts", "Writing-an-animated-flyout-hamburger-menu.md"));
|
|
var postRendered = Markdig.Markdown.ToHtml(post.Split("---")[1]);
|
|
return View(model: postRendered);
|
|
}
|
|
[Route("/Error")]
|
|
[ResponseCache(Duration = 0, Location = ResponseCacheLocation.None, NoStore = true)]
|
|
public IActionResult Error()
|
|
{
|
|
return View(new ErrorViewModel { RequestId = Activity.Current?.Id ?? HttpContext.TraceIdentifier });
|
|
}
|
|
}
|
|
}
|