feat: AddQueryString-Erweiterungsmethoden für String-Routen hinzufügen
This commit is contained in:
parent
94c6813306
commit
6cf47dc617
@ -7,6 +7,7 @@
|
||||
</PropertyGroup>
|
||||
|
||||
<ItemGroup>
|
||||
<PackageReference Include="Microsoft.AspNetCore.WebUtilities" Version="8.0.19" />
|
||||
<PackageReference Include="Microsoft.Extensions.DependencyInjection.Abstractions" Version="8.0.2" />
|
||||
<PackageReference Include="Microsoft.Extensions.Http" Version="8.0.1" />
|
||||
</ItemGroup>
|
||||
|
||||
@ -1,4 +1,5 @@
|
||||
using System.Reflection;
|
||||
using Microsoft.AspNetCore.WebUtilities;
|
||||
using System.Reflection;
|
||||
|
||||
namespace Leanetec.EConnect.Infrastructure;
|
||||
|
||||
@ -16,5 +17,16 @@ public static class ObjectExtensions
|
||||
}
|
||||
|
||||
public static string? ToSafeString(this object? obj)
|
||||
=> obj is bool b ? (b ? "true" : "false") : obj?.ToString();
|
||||
=> obj is bool b
|
||||
? (b ? "true" : "false")
|
||||
: obj?.ToString();
|
||||
|
||||
public static string? AddQueryString(this string? route, Dictionary<string, string?> queryPrams)
|
||||
{
|
||||
if (queryPrams.Count > 0)
|
||||
route = QueryHelpers.AddQueryString(route ?? string.Empty, queryPrams);
|
||||
return route;
|
||||
}
|
||||
|
||||
public static string? AddQueryString(this string? route, object queryPrams) => route.AddQueryString(queryPrams.ToPropertyDictionary());
|
||||
}
|
||||
Loading…
x
Reference in New Issue
Block a user