public ActionResult UpdateBankAccountBalance(string id, string userId, decimal balance)
        {
            var status = false;

            if (!String.IsNullOrEmpty(id) && User.Identity.GetUserId() == userId && Request.IsAjaxRequest() &&
                _readBankAccount.IsBankAccountCorrect(id, userId))
            {
                var bankAccount = _readBankAccount.GetBankAccountById(id);
                bankAccount.Balance = balance;
                _writeBankAccount.Edit(bankAccount);
                status = true;
            }

            return(new JsonResult()
            {
                Data = new { status = status }
            });
        }
示例#2
0
        public ActionResult LoadTransactionBySearchName(string name, string bankAccountId)
        {
            if (Request.IsAjaxRequest() && !String.IsNullOrEmpty(bankAccountId) && !String.IsNullOrEmpty(name))
            {
                var currencyLogic = new CurrencyLogic();
                var binder        = new ToTransactionListViewModel();

                var bankAccount = _readBankAccount.GetBankAccountById(bankAccountId);
                var transaction = _readTransaction.GetTransactionByName(name, bankAccountId);

                var viewModelTransaction =
                    binder.GetTransactions(transaction, currencyLogic.GetCurrencyIconById(bankAccount.Currency)).ToPagedList(1, 1);

                return(PartialView("TransactionList", viewModelTransaction));
            }

            return(new JsonResult()
            {
                Data = "Wystąpił błąd podczas operacji wczytywania transakcji po nazwie.",
                JsonRequestBehavior = JsonRequestBehavior.AllowGet
            });
        }