View NumericalExtensions.cs
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
using System; | |
namespace SimonGilbert.Blog | |
{ | |
public static class NumericalExtensions | |
{ | |
public static double RoundByDecimalPlaces(this double number, int numberOfDecimalPlaces = 2) | |
{ | |
return Math.Round(number, numberOfDecimalPlaces); | |
} |
View DateTimeExtensions.cs
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
using System; | |
namespace SimonGilbert.Blog | |
{ | |
public static class DateTimeExtensions | |
{ | |
public static string ToRelativeDate(this DateTime dateTime) | |
{ | |
var timeSpan = DateTime.Now - dateTime; |
View UnifiedController.cs
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
using Microsoft.AspNetCore.Http; | |
using Microsoft.AspNetCore.Mvc; | |
namespace SimonGilbert.Blog.Controllers | |
{ | |
public class UnifiedController : Controller | |
{ | |
[HttpGet] | |
public IActionResult Index() | |
{ |