Given the following class, what is your opinion on the best way to handle create/edit where Attributes.Count can be any 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 be able to edit both the Product details (Name) and Attribute details (Name/Value) in the same view, including adding and deleting new attributes.
Handling changes in the model is easy, what’s the best way to handle the UI and ActionMethod side of things?
Use the FormCollection and iterate through the key/value pairs. Presumably you can use a naming scheme that will allow you to determine which key/value pairs belong to your attribute set.