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

前端 未结 5 1750
孤街浪徒
孤街浪徒 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条回答
  •  梦毁少年i
    2021-02-08 01:52

    You can declare a form like this in your View and can specify whatever controller or Action you wish.

    Html.BeginForm("SaveAll", "Category", FormMethod.Post);
    

    If you are in a controller then you can use.

    TempData["Model"] = Model;
    RedirectToAction("SaveAll", "Category");
    

提交回复
热议问题