예제 #1
0
        public TransactionCreateViewModel GetViewModel(Model.BankAccount bankAccount, CurrencyLogic currencyLogic)
        {
            var viewModel = new TransactionCreateViewModel
            {
                AccountBalance = bankAccount.Balance,
                Currency       = currencyLogic.GetCurrencyIconById(bankAccount.Currency),
                BankAccountId  = bankAccount.Id,
                UserId         = bankAccount.User.Id
            };

            return(viewModel);
        }
        public Model.BankAccount GetBankAccount(BankAccountEditViewModel viewModel, User user)
        {
            var bankAccount = new Model.BankAccount()
            {
                Id       = viewModel.Id,
                Name     = viewModel.Name,
                Balance  = viewModel.Balance,
                Currency = viewModel.SelectedCurrencyId,
                Created  = viewModel.Created,
                User     = user
            };

            return(bankAccount);
        }
        public BankAccountDeleteViewModel GetViewModel(Model.BankAccount bankAccount, CurrencyLogic currencyLogic)
        {
            var viewModel = new BankAccountDeleteViewModel
            {
                Id       = bankAccount.Id,
                Name     = bankAccount.Name,
                Balance  = bankAccount.Balance,
                Currency = currencyLogic.GetCurrencyIconById(bankAccount.Currency),
                Created  = bankAccount.Created,
                UserId   = bankAccount.User.Id
            };

            return(viewModel);
        }
        public BankAccountEditViewModel GetViewModel(Model.BankAccount bankAccount)
        {
            var viewModel = new BankAccountEditViewModel
            {
                Id                 = bankAccount.Id,
                Name               = bankAccount.Name,
                Balance            = bankAccount.Balance,
                SelectedCurrencyId = bankAccount.Currency,
                Created            = bankAccount.Created,
                UserId             = bankAccount.User.Id
            };

            return(viewModel);
        }
        public BankAccountDetailsViewModel GetViewModel(Model.BankAccount bankAccount, CurrencyLogic currencyLogic)
        {
            var viewModel = new BankAccountDetailsViewModel()
            {
                Id       = bankAccount.Id,
                Name     = bankAccount.Name,
                Balance  = bankAccount.Balance,
                Currency = currencyLogic.GetCurrencyIconById(bankAccount.Currency),
                User     = bankAccount.User,
                SelectedItemsForPageId = 1
            };

            return(viewModel);
        }
예제 #6
0
        public Model.BankAccount GetBankAccount(BankAccountCreateViewModel viewModel, User user)
        {
            var bankAccount = new Model.BankAccount
            {
                Id       = Guid.NewGuid().ToString(),
                Name     = viewModel.Name,
                Balance  = viewModel.Balance,
                Currency = viewModel.SelectedCurrencyId,
                Created  = DateTime.Now,
                User     = user
            };

            return(bankAccount);
        }
예제 #7
0
        public Model.Transaction GetTransaction(TransactionEditViewModel viewModel, Model.BankAccount bankAccount)
        {
            var transaction = new Model.Transaction()
            {
                Id             = viewModel.Id,
                Name           = viewModel.Name,
                Amount         = viewModel.Balance,
                AccountBalance = viewModel.AccountBalance,
                SetDate        = viewModel.SetDate,
                Description    = viewModel.Description,
                BankAccount    = bankAccount
            };

            return(transaction);
        }
예제 #8
0
        public void Delete(BankAccount info)
        {
            #region 取資料
            Model.BankAccount query = this.Get(info.SeqNo);
            #endregion

            #region 邏輯驗證
            if (query == null)//沒有資料
            {
                throw new Exception("MessageNoData".ToLocalized());
            }
            #endregion

            #region 變為Models需要之型別及邏輯資料

            #endregion

            #region Models資料庫
            this._Repository.Delete(query);
            this._UnitOfWork.SaveChange();
            #endregion
        }
예제 #9
0
        public Model.Transaction GetTransaction(TransactionCreateViewModel viewmodel, Model.BankAccount bankAccount)
        {
            var transaction = new Model.Transaction
            {
                Id             = Guid.NewGuid().ToString(),
                Name           = viewmodel.Name,
                Amount         = viewmodel.Balance,
                AccountBalance = viewmodel.AccountBalance,
                SetDate        = viewmodel.SetDate,
                Description    = viewmodel.Description,
                BankAccount    = bankAccount
            };

            return(transaction);
        }