Adding slugify parameter transform (#185)

* Adding slugify parameter transform

Fixes #172

* Cleaning up code

And slugifying my orders
This commit is contained in:
Steve Smith
2019-01-11 12:39:48 -05:00
committed by GitHub
parent 8e748a4c62
commit bc328077b0
8 changed files with 91 additions and 75 deletions

View File

@@ -0,0 +1,17 @@
using Microsoft.AspNetCore.Routing;
using System.Text.RegularExpressions;
namespace Microsoft.eShopWeb.Web
{
public class SlugifyParameterTransformer : IOutboundParameterTransformer
{
public string TransformOutbound(object value)
{
if (value == null) { return null; }
// Slugify value
return Regex.Replace(value.ToString(), "([a-z])([A-Z])", "$1-$2").ToLower();
}
}
}