I have an object called Time
public class Time{
public int Hour {get;set;}
public int Minute {get;set;}
public static Time Parse(string timeString){
//reads the ToString()'s previous output and returns a Time object
}
override protected string ToString(){
//puts out something like 14:50 (as in 2:50PM)
}
}
So what I want is for the automatic model binding on the Edit or Create action to set this Time instance up from a string (i.e. feed the Parse method with the string and return the result).
The reason I am doing this is that I will have a DropDownList with selectable times. The value of each option will be the parser readable string.
Can anyone provide an example BindModel method from the IModelBinder interface?