我正在使用 MVC C# 假设我有以下 ActionResult:
public ActionResult Create(string location)
{
...
View()
}
我需要在 [httppost] 中使用主要位置
[HttpPost]
public ActionResult Create(Employee employee)
{
...
// I need to access the value of location here but I dont' have access to the View
}
获得位置价值的最佳方法是什么。我可以创建一个视图模型并将该值传递给视图,然后在 [HttpPost] 中检索它,但我无权访问视图,因为它受到限制。