我正在努力爲自己的行爲選擇適當的名字。我想返回一個以行動來區分:什麼是典型的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