For example, in the controller there is a function with input parameters Function (string str, int number). What are the ways to implement the transfer of parameters from a view to this method?

    1 answer 1

    You have a question heading contrary to the question itself, you already decide where you want to transfer: Controller->View or View->Controller

    View-> Controller

     @using(Html.BeginForm("Action", "Controller", FormMethod.Post) { <input type="text" name="str" value="String"/> <input type="text" name="number" value="1002"/> <input type="submit" value="Submit"/> } 
    • corrected the question title - Artem
    • but what if you need to transfer several complex objects, i.e. objects of actually developed classes? - Artem
    • @Artem use the model - tCode