I have a table that I want to pull items by name in a certain order and by date.
id name date
1 XYZ 1:30
2 ABC 1:40
3 LMNOQ 1:50
4 ABC 1:20
I created the order
List<string> itemNames = new List<string>();
documentOrder.Add("XYZ");
documentOrder.Add("ABC");
documentOrder.Add("LMNOQ");
Then pulled the data, I think order will stay intact.
var myTable = _context.TheTable.Where(x => itemNames.Contains(x.id));
myTable data will look like
id name date
1 XYZ 1:30
2 ABC 1:40
4 ABC 1:20
3 LMNOQ 1:50
Now I need to sort by dates without messing up the name order. I need it look like this.
id name date
1 XYZ 1:30
2 ABC 1:20
4 ABC 1:40
3 LMNOQ 1:50