public IActionResult CustomerOrders(int?CustomerID = null, int?SortBy = null) { var customers = _customerBL.GetCustomers(); ViewBag.Customers = customers .Select(i => new SelectListItem { Value = i.CustomerId.ToString(), Text = i.Name }).ToList(); ViewBag.SortOptions = GetSortOptions(); CustomerOrdersVM customerOrdersVM = _orderBL.GetCustomerOrdersVM(CustomerID, SortBy); return(View(customerOrdersVM)); }