Copied to clipboard

Flag this post as spam?

This post will be reported to the moderators as potential spam to be looked at


  • Fuji Kusaka 2203 posts 4220 karma points
    Oct 15, 2013 @ 14:24
    Fuji Kusaka
    0

    OrderBy UpdateDate in Media

    Anyone knows how to display OrderByDescending according to the latest media folder updated?

    I have the following code in my cshtml file but want to orderBy latest UpdateDate

       if(docFolder.ChildCount > 0){
                        var file = "";
                          var d = umbraco.library.DateDiff(docFolder.CreateDateTime.ToString("s"), Model.UpdateDate.ToString("s"), "m");
                        foreach (dynamic doc in docFolder.GetChildMedia().OrderByDescending(x=>x.CreateDateTime).Where(y=>y.ContentType.Alias =="File").Take(1))
                        { <strong>@doc.Parent.Text</strong> @doc
    }
  • Fuji Kusaka 2203 posts 4220 karma points
    Oct 15, 2013 @ 14:29
    Fuji Kusaka
    0

    Sorry this is what i want to achieve

    var d = umbraco.library.DateDiff(docFolder.CreateDateTime.ToString("s"), docFolder.UpdateDate.ToString("s"), "m");
     foreach (dynamic doc in docFolder.GetChildMedia().OrderByDescending(x=>x.d).Where(y=>y.ContentType.Alias =="File").Take(1))
Please Sign in or register to post replies

Write your reply to:

Draft