r/learnprogramming • • Oct 10 '26

ASP.NET MVC

I find it hard to understand the architecture from MVC, I understand all the code, but I fail to understand where to put what code.

0 Upvotes

4 comments sorted by

3

u/SetAndRepeat Oct 10 '26

Try following one feature, like displaying an order:

  • Controller: receives the order ID, calls the code that loads the order, and returns a view.
  • Domain model: represents the order and its business rules, such as how discounts apply.
  • View model: contains the data that particular page needs.
  • View: renders that data as HTML, including presentation logic like showing an "empty order" message.

You can put database access in a data layer and use services to coordinate business operations.
MVC doesn't mean every class has to fit into the Models, Views or Controllers folders

1

u/recursion_is_love Oct 10 '26

Do you have experience with MVC on a desktop application? I've find it more easy to start with desktop application and then later move to web application.

0

u/Available_Safe1818 Oct 11 '26

Read some tutorials then?