Controller vs Model: Where do I put the processing of user input?
https://softwareengineering.stackexchange.com/questions/109824
-
02-11-2019 - |
Frage
I'm new to MVC and I'm not using a framework (and I'm not going to).
I'm designing my new web application using MVC.
I have the user input received in Controller. Suppose I have form data
and an action
to do with it, which can be "insert", "delete" or "update".
Must I have process that action in Controller or in the Model? That is: must I do:
# Controller
if (action == "insert") Model.insert(data)
or
# Controller
Model.process(data, action)
# Model.process
if (action == "insert") self.insert(data)
(language-agnostic example).
What is the "MVC way" to do it?
Keine korrekte Lösung
Lizenziert unter: CC-BY-SA mit Zuschreibung
Nicht verbunden mit softwareengineering.stackexchange