I have a checkboxList
var checkBoxListAllStates = (CheckBoxList)PanelDeliveryState.GetAllControls().First(y => y.GetType() == typeof(CheckBoxList));
And a ListItem which will contain only the selected checkboxes
var onlySelectedStates = checkBoxListAllStates.Items.Cast<ListItem>().
Where (y => y.Selected).Select(y=>y.Value);
A database context variable : var query = _dbContext.Deliveries;
The problem is that when I want to query in the database for each value in the onlySelectedStates
the query will not function in the for each and it will retrieve only the list containing the first value.
The query is like this :
query = query.Where(y => y.State == (ExternalProductState)Enum.Parse(typeof(ExternalProductState), eachSelectedState).
Tried a lot but did not found a solution. Any idea ?
Aucun commentaire:
Enregistrer un commentaire