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
scroll top