//■■■■■■■■■■■■■■■■■■■■■■■■■■■■■■■■■■■■■■■■■■■■■■■■■■■■■■■■■■■■■■■■■■■■■■■■■■■■■■■■■■■■■■■■■ public Braintree(IServiceCollection services, /*IConfiguration configuration, IMediator med,*/ string connectionString) { Image = "location"; BraintreeDbContext.Configure(connectionString); RequiredConfigurationFields = new FluentList <ProviderConfiguration>() .Add(new ProviderConfiguration(nameof(ClientId))) .Add(new ProviderConfiguration(nameof(SecretId))) .Add(new ProviderConfiguration(nameof(Image))); services.AddTransient <TestController>(); }
//■■■■■■■■■■■■■■■■■■■■■■■■■■■■■■■■■■■■■■■■■■■■■■■■■■■■■■■■■■■■■■■■■■■■■■■■■■■■■■■■■■■■■■■■■ public string Create(string invoiceId, decimal amount) { //Payment Logic using var context = new BraintreeDbContext(); var paypal = new Paypal { Image = "test" }; context.PaypalPayments.Add(paypal); context.SaveChanges(); return($"PaymentID: {paypal.Id}"); }
//═════════════════════════════════════════════════════════════════════════════════════════ public Dictionary <string, object> Get(string paymentId) { using var context = new BraintreeDbContext(); return(context.PaypalPayments.FirstOrDefault().ToDictionary()); }