asp.net mvc - MVC Diagram - Two views for one controller -
basically, i've been asked draw mvc diagram application fire off project , i'm little confused.
i need draw basic mvc diagram (no problem), application can display 2 views of it's data; 1 view @ time.
i'm having difficulty finding examples of on web, appreciated.
so basically, can have view displays data , 1 allows edit it. that's 2 views of same data. you'd have 2 actions.
assuming user profile, you'd have like:
public class userprofilecontroller { public actionresult view(int userid) { //populate model return view(model); } public actionresult edit(int userid) { //populate model return view(model); } }
then you'd have 2 different views, view might like:
@model usermodel @html.labelfor(m => m.username) @html.displayfor(m => m.username) @html.labelfor(m => m.firstname) @html.displayfor(m => m.firstname)
then edit like:
@model usermodel @using (html.beginform()) { @html.labelfor(m => m.username) @html.editorfor(m => m.username) @html.labelfor(m => m.firstname) @html.editorfor(m => m.firstname) <input type="submit" value="save" /> }