ASP.Net MVC - post from one controller to another (action to action)

前端 未结 5 1756
孤街浪徒
孤街浪徒 2021-02-08 00:47

Is is possible to do a post from an Action \"Save\" in a controller \"Product\" to an Action \"SaveAll\" in a controller \"Category\"??

And also passing

5条回答
  •  天涯浪人
    2021-02-08 01:40

    Put the following code in your Product controller:

    return RedirectToAction("SaveAll", "Category")
    

    Here, "SaveAll" is an Action Name and "Category" is Controller Name. The user will then be redirected to the SaveAll action (i.e., the method will be called).

提交回复
热议问题