I have a Razor Template where I need to order a list of component links by a particular field in descending order (Fields.Date). Normally when I want to loop through a list I would just do something like the below:
@foreach(dynamic item in Fields.Articles)
{
//do something here
}
However the problem I am faced with is I need to sort the data before going into the loop and then write out the fields. Looking at the Razor Mediator documentation I can use List ComponentModel but I'm not sure what properties I can use?
@using Tridion.Extensions.Mediators.Razor.Models;
@{
List<ComponentModel> articleList = Fields.Articles;
}
I was hoping I would be able to do something like articleList.OrderByDescending(...).
Can anyone point me in the right direction please?