/// <summary>
        /// Converts from.
        /// </summary>
        /// <param name="model">The model.</param>
        /// <returns></returns>
        public TransactionPeriodViewModel ConvertFrom(TransactionForPeriodModel model)
        {
            TransactionPeriodViewModel viewModel = new TransactionPeriodViewModel();

            if (model == null)
            {
                return(viewModel);
            }

            viewModel.NumberOfTransactions = model.NumberOfTransactions;

            return(viewModel);
        }
예제 #2
0
        private async Task <IActionResult> GetTransactionsForPeriod(DatePeriod period, CancellationToken cancellationToken)
        {
            try
            {
                String accessToken = await this.HttpContext.GetTokenAsync("access_token");

                TransactionForPeriodModel transactionModel =
                    await this.ApiClient.GetTransactionsForDatePeriod(accessToken, this.User.Identity as ClaimsIdentity, period, cancellationToken);

                TransactionPeriodViewModel viewModel = this.ViewModelFactory.ConvertFrom(transactionModel);

                return(this.Json(viewModel));
            }
            catch (Exception e)
            {
                Logger.LogError(e);
                throw;
            }
        }