English 中文(简体)
由于某种原因,采用简易行动方法。 NET MVC 3
原标题:Ambiguous action method call, for some reason ASP.NET MVC 3

ers! I m a bit of a noob with this whole MVC thing, and I have run into a problem that I need some help with.

目前,我正在为一家管理寄养儿童的公司开展一个项目,该项目的主要部分是MVC网络,用于某些形式的寄养父母必须定期向公司提交。 迄今为止,我最大的问题一直是将已输入数据库的数据予以保存。 但是,我最近认识到,我可以这样做:

public ActionResult SaveForm(FormChildTherapeuticWeeklyForm formData)

Which is super awesome, and works perfectly for that first form. But after adding two more forms:

public ActionResult SaveForm(FormChildBasicCareMonthlyProgressReport formData)
public ActionResult SaveForm(FormFosterFamilyRequestForRemovalOrDischarge formData)

我已开始获得<><><>>>。 目前关于控制器型形式的主计长的行动请求在以下行动方法之间含糊不清:错误。

虽然我知道,我只能以不同的方式来说明每一项行动,但我希望看到,由于我犯了这一错误,能否做到这一点。

更有甚者:这三种观点中每一种都强烈地被归入三个模式/类别之一。

正如我说过的那样,我仍然同科索沃失踪人员调查委员会站在一起,但我将尽力提供你可能需要的任何其他信息。

感谢!

最佳回答

是的,最好为行动提供不同的名称,如果它们将不同的模式类别用作论据的话。

多国航天中心框架使用所谓的Binders,将网络形式(或美国宇宙航空研究开发机构)的数据与《南极海生委》的目标挂钩。 实现这种约束力并非三重方法,因为它将url-encoded格式的数据区分开来,并试图绘制相应的CRL物体的地图。

在某些情况下,有些物体可能拥有相同的财产名称。 能够理解如何进行适当的制图;

问题回答

http://msdn.microsoft.com/en-us/library/system.web.mvc.actionmethodselectorattribute.aspx”rel=“nofollow” ActionMethodSelectorAttribute,以便在这两种方法的用词之间脱节。

See an example here :

你们可以通过使用属性[HttpGet]和[HttpPost]来解决这个问题。 适用这些属性将说明应当针对特定申请类型采用何种方法。





相关问题
Anyone feel like passing it forward?

I m the only developer in my company, and am getting along well as an autodidact, but I know I m missing out on the education one gets from working with and having code reviewed by more senior devs. ...

NSArray s, Primitive types and Boxing Oh My!

I m pretty new to the Objective-C world and I have a long history with .net/C# so naturally I m inclined to use my C# wits. Now here s the question: I feel really inclined to create some type of ...

C# Marshal / Pinvoke CBitmap?

I cannot figure out how to marshal a C++ CBitmap to a C# Bitmap or Image class. My import looks like this: [DllImport(@"test.dll", CharSet = CharSet.Unicode)] public static extern IntPtr ...

How to Use Ghostscript DLL to convert PDF to PDF/A

How to user GhostScript DLL to convert PDF to PDF/A. I know I kind of have to call the exported function of gsdll32.dll whose name is gsapi_init_with_args, but how do i pass the right arguments? BTW, ...

Linqy no matchy

Maybe it s something I m doing wrong. I m just learning Linq because I m bored. And so far so good. I made a little program and it basically just outputs all matches (foreach) into a label control. ...

热门标签