mirror of
https://github.com/btcpayserver/btcpayserver.git
synced 2025-01-19 05:33:31 +01:00
29 lines
891 B
C#
29 lines
891 B
C#
using BTCPayServer.Abstractions.Form;
|
|
using BTCPayServer.Data;
|
|
using Microsoft.Extensions.DependencyInjection;
|
|
using Newtonsoft.Json;
|
|
using Newtonsoft.Json.Linq;
|
|
|
|
namespace BTCPayServer.Forms;
|
|
|
|
public static class FormDataExtensions
|
|
{
|
|
public static void AddForms(this IServiceCollection serviceCollection)
|
|
{
|
|
serviceCollection.AddSingleton<FormDataService>();
|
|
serviceCollection.AddSingleton<FormComponentProviders>();
|
|
serviceCollection.AddSingleton<IFormComponentProvider, HtmlInputFormProvider>();
|
|
serviceCollection.AddSingleton<IFormComponentProvider, HtmlFieldsetFormProvider>();
|
|
}
|
|
|
|
public static JObject Deserialize(this FormData form)
|
|
{
|
|
return JsonConvert.DeserializeObject<JObject>(form.Config);
|
|
}
|
|
|
|
public static string Serialize(this JObject form)
|
|
{
|
|
return JsonConvert.SerializeObject(form);
|
|
}
|
|
}
|