swagger ui - How to add drop-down list instead of a textfield -


i put "choose civil status" parameter inside post method in swagger-ui, instead of text fields wanted drop down list, i'm using mvc 3, can explain how can that?

here sample code..

 [httppost]         public string generate(string id, salutation salutation)         {              //code here         } 

inside inside controller put

var users = db.tablename;

        list<listitem> list = new list<listitem> ();         list.add(new listitem("please select", "0"));         foreach (var item in users)         {             list.add(new listitem(item.colname , item.userid.tostring()));         } 

viewbag.userlist = new selectlist(list, "valuefield", "textfield");

in view

 @html.dropdownlist("somename", (selectlist)viewbag.userlist , new { @class = "dropdownlist w150 ", value = @viewbag.selectedval })  

and have declare listitem in modelclasses


Comments

Popular posts from this blog

angularjs - ADAL JS Angular- WebAPI add a new role claim to the token -

php - CakePHP HttpSockets send array of paramms -

node.js - Using Node without global install -