ASP.NET MVC Editing A Collection Best Practices - Your Opinion -
given following class, opinion on best way handle create/edit attributes.count can number.
public class product { public int id {get;set;} public string name {get;set;} public ilist<attribute> attributes {get;set;} } public class attribute { public string name {get;set;} public string value {get;set;} }
the user should able edit both product details (name) , attribute details (name/value) in same view, including adding , deleting new attributes.
handling changes in model easy, what's best way handle ui , actionmethod side of things?
use formcollection , iterate through key/value pairs. presumably can use naming scheme allow determine key/value pairs belong attribute set.
[acceptverbs( httpverb.post )] public actionresult whatever( formcollection form ) { .... }
Comments
Post a Comment