Note that there are some explanatory texts on larger screens.

plurals
  1. POMVC3 Registration form and model
    primarykey
    data
    text
    <p>I have a question regarding the MVC 3 and more exaclty about the views and models. I want to mention that I'm new to MVC so I'm oly learning it.</p> <p>Basically for example lets take te registration form:</p> <p>I have a controller, view and model, to register a new user.</p> <ul> <li>AccountController</li> <li>Register.chtml</li> <li>AccountModel => RegisterationModel</li> </ul> <p>Now, in registration model i have all the datamembers with data annotations, for example:</p> <pre><code> [Required] [Display(Name = "User name")] public string UserName { get; set; } [Required] [DataType(DataType.Password)] [Display(Name = "Password")] public string Password { get; set; } </code></pre> <p>This are then rendered in view.</p> <p>What bothers me, or I don't really understand how to do it properly:</p> <p>Ok I have RegistrationModel ... but later on, for example if i want to render the profile of the user, should i call registrationmodel again or then it will be profilemodel? So basically I will have a lot of the same models just to render the same thing ... no?</p> <p>Can't I have then one general Model, something like user, and then User i can pass with RegistrationModel/ProfileModel to view.</p> <p>Maybe it is a bit difficult to understand what I mean exactly, but how I imagine it: for example a user submits a form, everything is parsed and a User object is created with all the data members, then this User object is pased to DAL, where it is submitted to DB. Later on someone visits the profile of this user and the DAL, will return User object back which is then displyed.</p>
    singulars
    1. This table or related slice is empty.
    1. This table or related slice is empty.
    plurals
    1. This table or related slice is empty.
    1. This table or related slice is empty.
    1. This table or related slice is empty.
    1. This table or related slice is empty.
    1. This table or related slice is empty.
 

Querying!

 
Guidance

SQuiL has stopped working due to an internal error.

If you are curious you may find further information in the browser console, which is accessible through the devtools (F12).

Reload