public ActionResult Index(JournalVoucherListModel model) { if (model.SetOfBooks == null) { model.SetOfBooks = sobService.GetByCompanyId(AuthenticationHelper.User.CompanyId) .Select(x => new SelectListItem { Text = x.Name, Value = x.Id.ToString() }).ToList(); model.SOBId = model.SetOfBooks.Any() ? Convert.ToInt32(model.SetOfBooks.First().Value) : 0; } if (model.Periods == null && model.SetOfBooks.Any()) { model.Periods = getPeriodList(model.SetOfBooks.First().Value); model.PeriodId = model.Periods.Any() ? Convert.ToInt32(model.Periods.First().Value) : 0; } if (model.Currencies == null && model.SetOfBooks.Any()) { model.Currencies = getCurrencyList(model.SetOfBooks.First().Value); model.CurrencyId = model.Currencies.Any() ? Convert.ToInt32(model.Currencies.First().Value) : 0; } model.JournalVouchers = getJournalVouchers(model); return View(model); }
private List<JournalVoucherViewModel> getJournalVouchers(JournalVoucherListModel model) { List<JournalVoucherViewModel> list = service.GetAll(AuthenticationHelper.User.CompanyId, model.SearchText, true, model.Page, model.SortColumn, model.SortDirection) .Select(x => new JournalVoucherViewModel(x)).ToList(); return list; }
public ActionResult GetJournalVoucherList(string sobId, string periodId, string currencyId) { JournalVoucherListModel model = new JournalVoucherListModel(); model.SOBId = Convert.ToInt32(sobId); model.PeriodId = Convert.ToInt32(periodId); model.CurrencyId = Convert.ToInt32(currencyId); model.JournalVouchers = getJournalVouchers(model); return PartialView("_List", model); }