我使用MVC C# 说我有以下的ActionResult:的ActionResult HttpPost需要访问值
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]中进行检索,但由于视图受限制,因此无法访问该视图。
定义受限? – 2012-07-24 22:10:11
我无法修改视图内的任何内容。该视图已创建。我们被告知不要以任何形式修改 – 2012-07-24 22:15:39
@NatePet - 这是功课吗?听起来就像作业通常需要的那种任意限制。 – 2012-07-24 22:21:28