Copied to clipboard

Flag this post as spam?

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


  • Daniel Harris 33 posts 94 karma points
    Feb 18, 2012 @ 23:52
    Daniel Harris
    0

    Getting Data out of Umbraco to create instances of Custom Class (Sports Results/League Table)

    What I want is for a user to be able to enter some sporting fixtures.

    This will include the following properties

    • Home Team
    • Away Team
    • Date of the fixture
    • The score of each team.

    The user will come back and enter the results later, once the fixture has been played.

    On another page I want to display the current league table, by looking at the fixtures that have results, and from that working out how many points each team has.

    The above is easy to do, say in a custom .NET Web Application. I am struggling to decide the best way to put this into Umbraco.

    I'm wanting to:

    • Create a document type called "Fixture" with fields for the properties mentioned above
    • The user enters the fixtures as Content with the type "Fixture"
    • Once the fixture is played the user puts the final score
    I can set the above up, but then in code (Say in a user control) how do I get that data back out? I have a custom Class (Result.cs) that has properties for everything I need to calculate the league standings,
    But how do I get the data out of Umbraco, even just a way to say get all results where the final score has been entered. Can I query the database easily enough? Or is there a better way to access the data stored within Umbraco.
    I don't want to use XSLT as I have my class representing a result, I want to get the data out for all the results, then I can use my Result class to do the rest.

  • Daniel Harris 33 posts 94 karma points
    Feb 23, 2012 @ 01:00
    Daniel Harris
    0

    In the end I just checked the ID for the conent types I needed to get, and then accessed these through the XML that is cached in the Database.

    This was Umbraco 4, for my final project using it. Going to move to Umbraco 5 for future projects.

Please Sign in or register to post replies

Write your reply to:

Draft