c# - How to pass initial json to another function in MVC controller -


i trying implement state machine mvc controller. client sends json messages action play of controller. each message has messagecode , other additional data, depends on messagecode.

exampple:

{messagecode:1, words:["aaa","bbb","ccc"]}  {messagecode:2, clientsage: 56, clientsname:"jon"}  ... 

thus, have

public jsonresult play(int messagecode) {         switch(messagecode){          case 1: //perform additional checks          return _dosomething1(words);          case 2: //perform additional checks          return _dosomething2(clientsage,clientsname); // } 

and each of private methods _dosomething1,_dosomething2 etc. have different signatures.

you use json function return json serialization of properties, like

return json(clientsname)  

and use json() want converto json

if want serializa , deserealize json, chek link how to: serialize , deserialize json data


Comments

Popular posts from this blog

javascript - Jquery show_hide, what to add in order to make the page scroll to the bottom of the hidden field once button is clicked -

javascript - Highcharts multi-color line -

javascript - Enter key does not work in search box -