ASP.NET MVC 中的操作
输入我的网址时 SalaryFor/Microsoft/Balmer 我需要显示名为 Balmer 的用户的工资 如果我输入 URL 微软/微软的薪资 我需要显示微软公司所有员工的工资
可以吗? 因为当我使用这个链接时 SalaryFor/Microsoft/Balmer 一切正常,
public ActionResult Salary(string company, string person)
公司和个人都包含价值观
,但此链接不起作用 SalaryFor/Microsoft
public ActionResult SalaryFor(string company, string person)
两个值都包含 null
我在 global.asax 中的路线是
routes.MapRoute("Salary",
"{controller}/{action}/{company}/{position}",
new
{
controller = "Salary",
action = "SalaryFor",
company = "",
test = ""
});
O 也许我做错了什么? 谢谢, 亚历山大.
When typing in my URL
SalaryFor/Microsoft/Balmer
i need to display salary for user with name Balmer
and if I type in URL
SalaryFor/Microsoft
i need to display salary for all employee in Microsoft company
Is it possible?
because when I use this link
SalaryFor/Microsoft/Balmer
all works fine
public ActionResult Salary(string company, string person)
both company and person contains values
but this link does not work
SalaryFor/Microsoft
public ActionResult SalaryFor(string company, string person)
both values contains null
my route in global.asax is
routes.MapRoute("Salary",
"{controller}/{action}/{company}/{position}",
new
{
controller = "Salary",
action = "SalaryFor",
company = "",
test = ""
});
O maybe I am making something wrong?
Thanks,
Alexander.
如果你对这篇内容有疑问,欢迎到本站社区发帖提问 参与讨论,获取更多帮助,或者扫码二维码加入 Web 技术交流群。
绑定邮箱获取回复消息
由于您还没有绑定你的真实邮箱,如果其他用户或者作者回复了您的评论,将不能在第一时间通知您!
发布评论
评论(1)
您需要绘制第二条路线。
You need to map a second route.