c# - web api - assign model at runtime to action -


public async task<ihttpactionresult> postuser(usermodel model)         {              //do              return ok();         } 

i have user model passed post request api. possible assign usermodel @ runtime. reason being, want keep usermodel dynamic (in separate pluggable dll) different implementation same api call.

also similar situation following get:

public userinfoviewmodel getuserinfo()         {             return new userinfoviewmodel             {                 //fill data             };         } 

similar dyanamic behaviour needed userinfoviewmodel

thanks

you should able use dynamic object model if don't want give concret object.

public async task<ihttpactionresult> postuser(dynamic model) 

Comments