Welcome Guest, Not a member yet? Register   Sign In
MVC & Database Queries
#1

[eluser]Unknown[/eluser]
Hi All,
My models currently contain the CRUD functions and so in the case of the read/get function it returns the entire record for any given value.

Now if I wish to do more specific queries such returning the 'count' or 'sum' of certain values in the database which is considered better practice?

1) Add specific query functions to my model for each query I wish to perform. However I notice in the MVC Wiki it says "Models: Apply limited business logic - if any - to database calls" --> Would this method be what the wiki is referring to?

OR

2) Return all records using my current 'Get' function and do the 'processing' in the controller to count/sum etc.

My application consists of a 'dashboard' showing various summarised information and hence will consist of a number of these type of queries.

Kind Regards.




Theme © iAndrew 2016 - Forum software by © MyBB