asp.net mvc 5 - Randomize loading order of products -


i working on site friend site can sell goods. got index view loading of ef 6, mvc 5 , people on here. wondering if there way randomize loading order it's different each time. here's code products control index method:

private accessorizeforlessentities entities = new accessorizeforlessentities();  // get: /products/ public actionresult index() {     var products = entities.products.include(p => p.productimage);      ienumerable<displayproductsviewmodel> model = products.select(p => new displayproductsviewmodel()     {         id = p.productid,         name = p.productname,         image = p.productimage,         price = p.productprice.tostring()     }).tolist();      return view(model); } 

is there way can alter code randomize loading order?

just order random. example:

entities.products.include(p => p.productimage).orderby(o => guid.newguid()) 

Comments

Popular posts from this blog

Fail to load namespace Spring Security http://www.springframework.org/security/tags -

sql - MySQL query optimization using coalesce -

unity3d - Unity local avoidance in user created world -