mirror of
https://github.com/btcpayserver/btcpayserver.git
synced 2024-11-19 09:54:30 +01:00
31 lines
1.1 KiB
C#
31 lines
1.1 KiB
C#
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, HtmlTextareaFormProvider>();
|
|
serviceCollection.AddSingleton<IFormComponentProvider, HtmlFieldsetFormProvider>();
|
|
serviceCollection.AddSingleton<IFormComponentProvider, HtmlSelectFormProvider>();
|
|
serviceCollection.AddSingleton<IFormComponentProvider, FieldValueMirror>();
|
|
}
|
|
|
|
public static JObject Deserialize(this FormData form)
|
|
{
|
|
return JsonConvert.DeserializeObject<JObject>(form.Config);
|
|
}
|
|
|
|
public static string Serialize(this JObject form)
|
|
{
|
|
return JsonConvert.SerializeObject(form);
|
|
}
|
|
}
|