Copied to clipboard

Flag this post as spam?

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


  • Mygel 9 posts 40 karma points
    Nov 29, 2014 @ 19:55
    Mygel
    0

    How To Filter Articles Based On Properties

    Hey Fourm,

    The last few days I have been stumped and need some assistance. Sorry I haven't optimize my images!

    Website: http://breathedota.azurewebsites.net/

    I would like implement my filter and filter articles based on certain properties. One of the properties is experience level (Beginner, Intermediate, Advance).
    Here is an image of my back office: http://i.imgur.com/4Bp0wQU.png

    Currently the articles being displayed on my homepage is from a macroScript. 
    MacroScript: http://pastebin.com/34HZiRr2

    Essentially my website is composed like this:

    <Html>
    <header></header>
    <Body>

    @Umbraco.RenderMacro("RazorListing")

    <div>Filters and Categories</div>
    </body>
    <Html>

    I have looked into URL Queries/Passing Parameters. If you click Beginner it filters all the articles by adding to the URL www.xxx.com?Experience=Beginner. If I choose a different category(I.e Recommended) then I should be able to filter everything in that category by Experience Level. 

    My Question:
    1. How do I filter my articles based on a specific property(Beginner, Intermediate, Advance)?

    I'm really struggling since I am jumping between front and back end of web development. I'm not sure how I should structure my code or approach this problem. If more season developers could share experience, code samples, or a hack then It would I would be incredibly grateful. 

  • Daniel Larsen 116 posts 381 karma points
    Dec 04, 2014 @ 16:45
    Daniel Larsen
    0

    Hi Mygel

    Have you tried with .Where("experience == beginner") ?

    Example:

    @foreach (var item in Model.Where("experience == beginner").OrderBy("UpdateDate") 
    {
       //Do stuff
    }
    

    I hope this helps :-)

    /Daniel

Please Sign in or register to post replies

Write your reply to:

Draft