public IActionResult SetFilter(InvoiceFilterViewModel model) { // save filter to session SetInvoiceFilter(model); return(RedirectToAction("Index")); }
// GET: Invoice using Aging filter public async Task <ActionResult> IndexFilter([FromQuery] InvoiceFilterViewModel model) { var companies = await _companyBusinessManager.GetCompanies(); ViewBag.Companies = companies.Select(x => new SelectListItem() { Text = x.Name, Value = x.Id.ToString() }).ToList(); return(View("Index", model)); }
public async Task <Pager <InvoiceListViewModel> > GetInvoices([FromQuery] InvoiceFilterViewModel model) { var result = await _businessManager.GetInvoicePage(_mapper.Map <InvoiceFilterDto>(model)); var list = _mapper.Map <List <InvoiceListViewModel> >(result.Items); foreach (var invoice in list) { var tags = await _businessManager.GetCustomerTags(invoice.CustomerId); if (tags != null) { invoice.CustomerTags = tags.Select(x => x.Name).ToArray(); } } return(new Pager <InvoiceListViewModel>(list, result.TotalItems, result.CurrentPage, result.PageSize, result.Params)); }
public async Task <IActionResult> FilterView([FromQuery] InvoiceFilterViewModel model) { var companies = await _companyBusinessManager.GetCompanies(); var customerTypes = await _businessManager.GetCustomerTypes(); var viewDataDictionary = new ViewDataDictionary(new EmptyModelMetadataProvider(), new ModelStateDictionary()) { { "Companies", companies.Select(x => new SelectListItem() { Text = x.Name, Value = x.Id.ToString() }).ToList() }, { "CustomerTypes", customerTypes.Select(x => new SelectListItem() { Text = x.Name, Value = x.Id.ToString() }).ToList() } }; string html = await _viewRenderService.RenderToStringAsync("_FilterInvoicePartial", model, viewDataDictionary); return(Ok(html)); }
public async Task <ActionResult> Index() { var companies = await _crudBusinessManager.GetCompanies(); ViewBag.Companies = companies.Select(x => new SelectListItem() { Text = x.General.Name, Value = x.Id.ToString() }); var vendors = await _crudBusinessManager.GetVendors(); ViewBag.Vendors = vendors.Select(x => new SelectListItem() { Text = x.General.Name, Value = x.Id.ToString() }); var model = new InvoiceFilterViewModel() { CompanyId = null }; return(View(model)); }
public async Task <Pager <InvoiceListViewModel> > GetInvoices([FromQuery] InvoiceFilterViewModel model) { var result = await _crudBusinessManager.GetInvoicePager(_mapper.Map <InvoiceFilterDto>(model)); return(new Pager <InvoiceListViewModel>(_mapper.Map <List <InvoiceListViewModel> >(result.Data), result.RecordsTotal, result.Start, result.PageSize)); }
private void SetInvoiceFilter(InvoiceFilterViewModel filter) { HttpContext.Session.SetObjectAsJson("InvoiceFilter", filter); }