I want to sort two models by Datetime, both of them going to one timeline so i need the newest from them to be on the start of the list timeline, I found solutions like Union models, but I want them to remain two separate lists..Is it possible?
foreach (var list1 in model.list1.OrderByDescending(a => a.created_datetime))
{
09/18/19
}
foreach (var list2 in model.list2.OrderByDescending(a => a.created_datetime))
{
09/19/19
}
Now I want the timeline result to be listed in the second list because it is an earlier result
Thanks for your help, the most helpful solution I found to the problem is:- Sorting the list by a JS function that runs on the uploaded content.
here is the code:
var item = $(".sort-item").sort(function (a, b) {
var Adate = $(a).attr("data-date");
var Bdate = $(b).attr("data-date");
var Atime = $(a).attr("data-time");
var Btime = $(b).attr("data-time");
if (Adate < Bdate) return 1;
if (Adate > Bdate) return -1;
if (Atime < Btime) return 1;
if (Atime > Btime) return -1;
return 0;
});
$(".timeline").prepend(item);