I am reasonably new to the MVC pattern.
I have a model called Address
which can be used in a few separate places throughout my application, such as:
- Addresses against an order
- Addresses against a customer
- Addresses against a supplier
You can create these addresses on separate screens (such as order, customer or supplier maintenance), however they ultimately end up in the same address
table, although each one adds the id
into it's own respective table.
I don't want to have to have 3 copies of the code that creates the address model and saves it. Where does this logic fit? It currently sits in the order controller (as I have not yet written the customer and supplier part). Does it go in its own controller (Address
) and simply get's accessed from the order
,customer
, or supplier
controllers? Is it normal to call a controller from another controller?
I'm thinking that alot of my logic at belongs in my models but I'm not too sure. At the moment, my controllers are quite heavy whereas my models really only have the getters and setters.