Asp.Net MVC Not Duplicate forms when Edit/Add -


When we have anything that requires user input (for example adding a product to a database) screen Edit Screen looks like When using MVC. How do you handle it? Do you return the same scene? Just adjust the model to reflect the change?

same (partial) view

You only make one, but Strong typed (depending on the UI it can definitely be a partial view), when the new data is added, this view is the default model object instance (usually the only one without setting any properties New instance) comes back to this scene with controller action, but when you edit, that audio Edit it back with Ject instance that you want to edit.

Part of Controller

You can be four of them in relation to the control functions:

  1. Add GET. See Return ("Some View", New Customer ());
  2. Add Post
  3. Edit GET
    See Return ("Some View", New Customer Replication (.) GetCustomer (id));
  4. Edit POST

    A BOT operation returns the same view, but as previously mentioned, with a different model. Post operations after submitting both tasks, but return whatever they need. Maybe some redirect () ...


Comments