c# - URL-Encoded post parameters don't Bind to model -


i have following model

namespace clientapi.models {      public class internal {          public class reportrequest {              public datetime starttime;             public datetime endtime;             public string filename;             public string username;             public string password;         }     } } 

with following method:

[httppost]  public httpresponsemessage getquickbooksofxservice(internal.reportrequest request){             return getquickbooksofxservice(request.username,           request.password, request.starttime, request.endtime, request.filename);  } 

my webform looks this:

<form method="post" action="http://localhost:56772/internal/getquickbooksofxservice"    target="_blank"> <input type="text" name="starttime" value="2013-04-03t00:00:00"> <input type="text" name="endtime" value="2013-05-04t00:00:00"> <input type="text" name="filename" value="export_2013-04-03_to_2013-05-03.qbo"> <input type="text" name="username" value="username"> <input type="text" name="password" value="*****"> <input type="submit" value="submit"></form> 

my question is:

i getquickbooksofxservice function model has nulls in instead useful. doing wrong?

after doing more testing found not properties in class need public need , set method. after making following started working.

  public class reportrequest     {         public datetime starttime { get; set; }         public datetime endtime { get; set; }         public string filename { get; set; }         public string username { get; set; }         public string password { get; set; }     } 

Comments

Popular posts from this blog

linux - Does gcc have any options to add version info in ELF binary file? -

android - send complex objects as post php java -

charts - What graph/dashboard product is facebook using in Dashboard: PUE & WUE -