public IViewComponentResult Invoke() { FilterSaleViewModel filter = new FilterSaleViewModel(); filter.Producs = _repository.GetProducts() ?? new List <Domain.Product>(); filter.Customers = _repository.GetCustomers() ?? new List <Domain.Customer>(); return(View(filter)); }
public IActionResult Index(FilterSaleViewModel filter) { List <SaleViewModel> models = new List <SaleViewModel>(); var sales = _repository.GetSales(filter.ProductId, filter.CustomerId, filter.StartPurchaseDate, filter.EndPurchaseDate); models = sales?.Select(x => new SaleViewModel { Id = x.Id, CustomerId = x.CustomerId, ProductId = x.ProductId, CustomerName = x.CustomerName, ProductName = x.ProductName, PurchaseDate = x.Date }).ToList(); return(View(models)); }