public ActionResult GetTransactionsBySearchNameFilters(string bankAccountId, string name, string fromDate, string toDate, int?selectedItemsForPage, int?selectedFilterId, int page = 1) { if (!String.IsNullOrEmpty(bankAccountId) && !String.IsNullOrEmpty(name)) { var bankAccount = _readBankAccount.GetBankAccountById(bankAccountId); var binder = new ToTransactionListViewModel(); var currencyLogic = new CurrencyLogic(); var filterLogic = new FiltersLogic(); var filterName = ""; var filterValue = ""; var fromDateConverted = filterLogic.GetDateTimeByDateStringWithDots(fromDate); var toDateConverted = filterLogic.GetEndDateTimeDateStringWithDots(toDate); filterLogic.GetFilterNameFilterValueById(selectedFilterId, out filterName, out filterValue); var itemsForPage = filterLogic.GetItemsForPageById(selectedItemsForPage); var transactions = _readTransaction.GetSearchTransactionsByFilters(bankAccountId, fromDateConverted, toDateConverted, filterName, filterValue, name); var viewModelTransactions = binder.GetTransactions(transactions, currencyLogic.GetCurrencyIconById(bankAccount.Currency)).ToPagedList(page, itemsForPage); return(PartialView("TransactionList", viewModelTransactions)); } else { return(new JsonResult { Data = "Wystąpił błąd podczas operacji.", JsonRequestBehavior = JsonRequestBehavior.AllowGet }); } }
public ActionResult GetTransactionsByBankAccountId(string bankAccountId, int page = 1, int selectedItemsForPage = 1) { if (!String.IsNullOrEmpty(bankAccountId)) { var bankAccount = _readBankAccount.GetBankAccountById(bankAccountId); var binder = new ToTransactionListViewModel(); var currencyLogic = new CurrencyLogic(); var filterLogic = new FiltersLogic(); var itemsForPage = filterLogic.GetItemsForPageById(selectedItemsForPage); var viewModelTransactions = binder.GetTransactions(bankAccount.Transactions, currencyLogic.GetCurrencyIconById(bankAccount.Currency)).ToPagedList(page, itemsForPage); return(PartialView("TransactionList", viewModelTransactions)); } else { return(new JsonResult { Data = "Wystąpił błąd podczas operacji.", JsonRequestBehavior = JsonRequestBehavior.AllowGet }); } }