My application has 10 products that are listed on a products page. When a user clicks one of these products they get directed to the details page for that product.
I would like to implement a next/previous pager on the details page that takes you to the next or previous product without having to go back to the products page.
I am assuming I have to write strongly typed view data that returns both the Product object as well as identifiers (SKU in this case) for the next and the previous product based on the product selected.
public class ProductViewData
{
public Product product
{
get;
set;
}
public string NextSKU
{
get;
set;
}
public string PreviousSKU
{
get;
set;
}
}
The question is, how do I get to the previous and next identifiers using LINQ in a efficient way?
Thanks