Post/Send Anonymous object to MVC/WebAPI Action/Method
I was building an MVC application where we need to give the option to the user to maintain the reference/lookup data through the UI. To active this I created different model and partial views. In order to render the partial view I need to create the different action methods and code wise it will be repetition of code. So I finalized to create one action method that take 2 parameter, the first parameter will tell me the type and second parameter will be object Type. Let me show me how I achieve this with an example. Step 1 – Model namespace WebApplication2.Models.Lookup { public class User { public int UserID { get; set; } public string UserCode { get; set; } public string FirstName { get; set; } public string LastName { get; set; } ...