0

I am trying to implement an MVC 5 controller, JsonResult POST method, that serves as a handler where the logic will define do next in a custom workflow. Basically, i want to post to this method from many different views that all have their own data model, and then "do stuff" based on the specific model passed into the handler method. This way, no matter where i am in the workflow, i can return data back to the UI for every step that has been completed and then invoke a new Ajax request if the workflow is not complete or even stop the process in general if the user wishes.

I have searched to see how i can identify the model passed into the controller method from the razor view AJAX helper method, but came up empty so far.

Does anybody know if this is possible?

I don't believe code is necessary to obtain an answer to this question, but if you have any questions, i will be happy to provide more information.

Thanks in advance!

Richard

R. Scott
  • 1
  • 2
  • See http://stackoverflow.com/questions/7222533/polymorphic-model-binding – L-Four Jul 18 '16 at 13:56
  • Maybe i can pass the name of the data model from the razor view as well.. that would likely work.. but i am hopeful there is a way to identify the model as one of the first few steps in the controller method. – R. Scott Jul 18 '16 at 13:58
  • http://stackoverflow.com/questions/7222533/polymorphic-model-binding looks like it may work. I am going to give a try now. – R. Scott Jul 18 '16 at 14:00
  • Thanks for the links. I managed to get it with .GetType().Name before i even render the view and pass in an empty model with only the string name of the model in a hidden field model.ModelType = model.GetType().Name; – R. Scott Jul 19 '16 at 21:55

0 Answers0