I would like to have in the registration form in my site an interface. lets call it IShape. there are serval interface implementations, like ISquare and ICycle, each one has its own properties except the shared ones declared in the interface.
I want the user to have the ability to have as many shapes as he wants from all types posssible, and be able to fill them with information, which I receive as RegisterModel.
public class RegisterModel
{
[Required]
[Display(Name = "Username")]
public string UserName { get; set; }
[Required]
[Display(Name = "Shapes")]
public List<string> Shapes { get; set; }
}
Register Action:
public ActionResult Register(RegisterModel model)
{
if (ModelState.IsValid)
{
// Iterate over the shapes
model.Shapes ...
}
}
Please refer to the javascript issue, since if I have multiple objects their names will conflict. For example: 2 shapes has size property. if I create two textboxes with the name "size", The ASP.NET engine won't be able to solve it.
Thanks!