asp.net mvc - How to create a generic controller action -


i have following controller action:

public actionresult saveedits(magheader viewmodel) {         apprepository.savedata(viewmodel);         return partialview("displayformodel", viewmodel);     } 

the viewmodel simple , holds few properties.

public class magheader {     public string magdate { get; set; }      public string magtitle { get; set; }  } 

this works fine. however, issue have 40 of these different viewmodels , controller action each. it's doing saving data properties of each can through reflection.

is there way have 1 controller handle of them? string properties key/value pairs. there way make controller action generic?


Comments

Popular posts from this blog

android - Get AccessToken using signpost OAuth without opening a browser (Two legged Oauth) -

org.mockito.exceptions.misusing.InvalidUseOfMatchersException: mockito -

google shop client API returns 400 bad request error while adding an item -