Esempio n. 1
0
        /// <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);
        }
Esempio n. 2
0
        /// <summary>
        /// </summary>
        /// <param name="output"></param>
        public void Standard(GetAccountsOutput output)
        {
            var getAccountDetailsResponse = new GetAccountsResponse(output.Accounts);

            this.ViewModel = new OkObjectResult(getAccountDetailsResponse);
        }