asp mvc http get action with object as parameter

前端 未结 3 2071
慢半拍i
慢半拍i 2021-01-05 09:06

In my controller I got action:

[HttpGet]
public ActionResult CreateAdmin(object routeValues = null)
{
    //some code
    return View();
}

3条回答
  •  孤独总比滥情好
    2021-01-05 09:38

    You can pass values to a Http Get method like

    Html.Action("ActionName","ControllerName",new {para1=value, para2 = value});
    

    and you can have your action defined in the controller like

    [HtttpGet]
    public ActionResult ActionName(Para1Type para1, Para2Type para2)
    {
    }
    

提交回复
热议问题