I'm developing a Windows Form application, with Entity Framework 6 + MySQL.
As is common in systems, I have in each form navigation buttons (First Record, Previous Record, Next Record, Last Record)
The question: Is there any definite syntax (LINQ or Lambda) that leads me directly to the previous or next EXISTING record?
Example: I have the form displaying the record ID = 6. If I click the previous button, I should display record 5. Similarly, the next one is record 7. However, if record 7 does not exist, record 8 must be displayed .
I can easily solve with programming logic, but I would like to know if there is a native language way to solve this type of operation.
Thank you.