0

following scenario: I have x amount of elements with different dates. I want to group those elements by date and display all elements for each day. I want to display only 3 days per page. Data is loaded on page refresh in a model.

What I am currently doing is load all elements in global.asax and have a list of objects which I am using for the relation between page id and date. Now when I open a page with the id 1, I get all videos with the date according to the id. Now when I add an item to the database, I'd obviously have to redo the whole process. I was wondering if there was a better way to handle this whole thing.

  • 1
    You can begin by going here: http://www.asp.net/mvc/overview/getting-started/introduction/getting-started – joordan831 Jan 15 '16 at 23:38

1 Answers1

0

Well Marianne, there's no code in your question so nobody will be able to speak to that.

Your architecture could use a few tweaks. Things that stick out are:

  1. Using global.asax like a controller. That's a big no-no. Use the controller as it's meant to be used. If you absolutely need to cache some of the database results, take a look at SqlDependency.
  2. If I am reading your post correctly, it would appear you are not using an WHERE clause in your sql query. Another big no-no.

I bet with those two changes you would find most of your issue goes away. If after making those changes you find you still have an issue, feel free to post a new question.

Community
  • 1
  • 1
Sam Axe
  • 33,313
  • 9
  • 55
  • 89
  • Everything's working just fine for now. But it feels rather hacky which is why I am asking. My code works as intended whether its beautiful or not. I probably didnt express my problem very well. I am not using global.asax as a controller. I am using it to set the static page to date relation which I am using to get the videos by date for a specific page. – Marianne Markwardt Jan 15 '16 at 23:48