public static async Task <BankClientProfileFluentResponse> UpsertAsync(this BankClientProfileContext context) { context.ArgNotNull(nameof(context)); IList <FluentResponseMessage> validationErrors = Validate(context); if (validationErrors.Count > 0) { return(new BankClientProfileFluentResponse(messages: validationErrors, data: null)); } try { BankClientProfileResponse result = await PersistOpenBankingClient(context); return(new BankClientProfileFluentResponse(result)); } catch (AggregateException ex) { context.Context.Instrumentation.Exception(ex); return(new BankClientProfileFluentResponse(messages: ex.CreateErrorMessages(), data: null)); } catch (Exception ex) { context.Context.Instrumentation.Exception(ex); return(new BankClientProfileFluentResponse(message: ex.CreateErrorMessage(), data: null)); } }
protected override void ProcessRecordInner(IServiceProvider services) { List <FluentResponseMessage> messages = new List <FluentResponseMessage>(); try { ICreateBankClientProfile createBankClientProfile = services.GetService <ICreateBankClientProfile>(); BankClientProfileResponse response = createBankClientProfile .CreateAsync(BankClientProfile) .GetAwaiter() .GetResult(); BankClientProfileFluentResponse response2 = new BankClientProfileFluentResponse(messages: messages, data: response); WriteObject(response2); } catch (Exception ex) { WriteError( new ErrorRecord( exception: ex, errorId: "Could not create record", errorCategory: ErrorCategory.InvalidOperation, targetObject: null)); } }
public BankClientProfileFluentResponse( IList <FluentResponseMessage> messages, BankClientProfileResponse data) : base(messages) { Data = data; }
public static async Task <BankClientProfileFluentResponse> SubmitAsync(this BankClientProfileContext context) { context.ArgNotNull(nameof(context)); IList <FluentResponseMessage> validationErrors = Validate(context); if (validationErrors.Count > 0) { return(new BankClientProfileFluentResponse(messages: validationErrors, data: null)); } try { CreateBankClientProfile i = new CreateBankClientProfile( apiClient: context.Context.ApiClient, mapper: context.Context.EntityMapper, dbMultiEntityMethods: context.Context.DbContextService, bankClientProfileRepo: context.Context.ClientProfileRepository, softwareStatementProfileService: context.Context.SoftwareStatementProfileService); BankClientProfileResponse resp = await i.CreateAsync(context.Data); return(new BankClientProfileFluentResponse(resp)); } catch (AggregateException ex) { context.Context.Instrumentation.Exception(ex); return(new BankClientProfileFluentResponse(messages: ex.CreateErrorMessages(), data: null)); } catch (Exception ex) { context.Context.Instrumentation.Exception(ex); return(new BankClientProfileFluentResponse(message: ex.CreateErrorMessage(), data: null)); } }
public BankClientProfileFluentResponse( FluentResponseMessage message, BankClientProfileResponse data) : this(messages : new[] { message }, data : data) { }
public BankClientProfileFluentResponse(BankClientProfileResponse data) : this(messages : (IList <FluentResponseMessage>)null, data : data) { }
public BankClientProfileHttpResponse(BankClientProfileResponse data, MessagesResponse messages) { Data = data; Messages = messages; }