I have a class like this
public class Position
{
public string Title { get; set; }
public IEnumerable<string> PhoneNumbers { get; set; }
}
I wanted to use a textarea to accept phone numbers as one per line. After that the model obviously doesn't bind correctly, so I found IModelBinder
that can help with this, but I don't see how I can inject the transformed data back into the model.
public object BindModel(ControllerContext controllerContext, ModelBindingContext bindingContext)
{
var phones = bindingContext.ValueProvider.GetValue("phones");
var values = phones.AttemptedValue;
var phoneList = ..... //split and stuff
//now what? how to set it back?
Thank you