Nicholas Mabe

Nicholas Mabe

  • NA
  • 72
  • 4.8k

How to filter a public IEnumerable<SelectListItem> with .Where?

Jan 9 2021 9:09 AM
Very new to Net Core and CSharp, I am trying to filter a list before it posts
 
proposalVM.ProposalCategoryList = _unitOfWork.ProposalCategory.GetAll().OrderBy(s => s.ProposalCategoryName).Where(s => s.ProposalCategoryName != "Freight").Select(i => new SelectListItem
{
Text = i.ProposalCategoryName,
Value = i.ProposalCategoryId.ToString()
});
 
I don't get an error but neither does it filter the list. Any help is gratefully received.  

Answers (4)