KnowledgeHub
Questions
Tags
Users
Search
Alex Rivera
|
Logout
Edit Question
Title
Body
I'm not very familiar with the MVC pattern. Could you tell me which one of the following three controller actions is better? Thanks :) (1) Have query in action: public ActionResult List() { var query = repository.Query().Where(it => it.IsHandled).OrderBy(it => it.Id); // ... } (2) Have query in service: public ActionResult List() { var items = service.GetHandledItemsOrderById(); // ... } (3) Have order by in action: public ActionResult List() { var items = service.GetHandledItems().OrderBy(it => it.Id); // ... } If we choose (1), then we have too much business logic in controller? If we choose (2), there might be lots of service methods like GetXXXByYYY() . If we choose (3), why we encapsulate Where(it => it.IsHandled) but not OrderBy(it => it.Id . Any ideas?
Tags (comma-separated)
Save Edits
Cancel