mirror of
https://github.com/meysamhadeli/booking-microservices.git
synced 2026-04-11 10:32:09 +08:00
17 lines
472 B
C#
17 lines
472 B
C#
using System.Globalization;
|
|
using System.Text.RegularExpressions;
|
|
using Microsoft.AspNetCore.Routing;
|
|
|
|
namespace BuildingBlocks.Web;
|
|
|
|
public class SlugifyParameterTransformer : IOutboundParameterTransformer
|
|
{
|
|
public string TransformOutbound(object value)
|
|
{
|
|
// Slugify value
|
|
return value == null
|
|
? null
|
|
: Regex.Replace(value.ToString() ?? string.Empty, "([a-z])([A-Z])", "$1-$2").ToLower(CultureInfo.CurrentCulture);
|
|
}
|
|
}
|