c# - ASP.NET MVC - Overriding an action with differing parameters -


i have controller inherits base controller. both have edit (post) action take 2 arguments:

on base controller:

[httppost] public virtual actionresult edit(idtype id, formcollection form) 

and in derived controller:

[httppost] public actionresult edit(int id, someviewmodel viewmodel) 

if leave exception because there ambiguous call. however, can't use override on derived action, because method signatures don't match. there can here?

as addition developer art's answer workaround be:

leave base method , in derived class implement base method , annotate [nonaction]

[nonaction] public override actionresult edit(idtype id, formcollection form) {    // nothing or throw exception }  [httppost] public actionresult edit(int id, someviewmodel viewmodel) {    // implementation } 

Comments

Popular posts from this blog

ASP.NET/SQL find the element ID and update database -

jquery - appear modal windows bottom -

c++ - Compiling static TagLib 1.6.3 libraries for Windows -