/// <summary> /// Executes the Use Case. /// </summary> /// <param name="input">Input Message.</param> /// <returns>Task.</returns> public async Task Execute(GetAccountsInput input) { if (input is null) { this._getAccountsOutputPort .WriteError(Messages.InputIsNull); return; } IUser user = this._userService .GetUser(); List <IAccount> accounts = new List <IAccount>(); if (user.CustomerId is { } customerId) { accounts.AddRange(await this._accountRepository .GetBy(customerId) .ConfigureAwait(false)); } var output = new GetAccountsOutput(accounts); this._getAccountsOutputPort .Standard(output); }
/// <summary> /// </summary> /// <param name="output"></param> public void Standard(GetAccountsOutput output) { var getAccountDetailsResponse = new GetAccountsResponse(output.Accounts); this.ViewModel = new OkObjectResult(getAccountDetailsResponse); }