ASP.NET MVC - passing parameters to the controller

后端 未结 10 1316
小蘑菇
小蘑菇 2020-11-28 23:36

I have a controller with an action method as follows:

public class InventoryController : Controller
{
    public ActionResult ViewStockNext(int firstItem)
           


        
10条回答
  •  眼角桃花
    2020-11-29 00:15

    or do it with Route Attribute:

    public class InventoryController : Controller
    {
        [Route("whatever/{firstItem}")]
        public ActionResult ViewStockNext(int firstItem)
        {
            int yourNewVariable = firstItem;
            // ...
        }
    }
    

提交回复
热议问题