我正在努力为自己的行为选择适当的名字。我想返回一个以行动来区分:什么是典型的ASP.NET MVC - 控制器动作名称约定?
- 创建
- 编辑
- 编辑,创建
这是我到目前为止有:
Create --> Show the Empty Form for Create Add --> Receives data from Create and Save New Entity Edit --> Shows Existing Entity in a form for editing Update --> Saves the changes on an existing Entity ??? --> Shows the form for either editing or creating depending on the situation Save --> Either saves or updates the entity depending on whether the entity already exists or not.
那么,什么是适当的行动名称显示Create/Edit
视图,它将数据发送到Save
。
我曾考虑过CreateEdit
,因为它很清楚明确,但我不确定。有什么建议么?
创建通常是窗体淋浴(GET)和数据接收器(POST)。 – bzlm 2010-10-19 13:16:36
我已经将这些结合在重载中,并想知道这种方法是否有任何优点或缺点。 – bzarah 2010-10-19 13:21:29
@bzarah缺点?不知道任何。优点?使您遵守REST标准。 – bzlm 2010-10-19 13:42:30