title: Custom parse value for ViewModel property (Custom Bind)
body: <p>I have the following struct:</p>
  
  <pre><code>public struct DataRange
  {
      public DateTime BeginDate {get;set;}
      public DateTime EndDate {get;set;}
  }
  </code></pre>
  
  <p>This struct is used on many actions of my asp.net mvc 5 app. </p>
  
  <p>I am using a custom input (<a href="http://www.daterangepicker.com/" rel="nofollow noreferrer">daterangepicker</a>) and i want to bind the custom string value of the input to my custom datatype just one time and use it along my app.</p>
  
  <p>E.g:</p>
  
  <pre><code>public class FindSalesByDateViewModel
  {
      public DateRange Interval {get; set;}
  }
  
  public class SalesController : Controller
  {
      public ActionResult Index(FindSalesByDateViewModel model)
      {
          //Access the model.Interval without parse the string value always.
      }
  }
  </code></pre>
  
  <p>I'm a beginner on mvc development. 
  I found the following solutions that are not very attractive, is there any other way to accomplish this?</p>
  
  <p><a href="https://stackoverflow.com/questions/2186969/custom-model-binder-for-a-property">Solution 1</a></p>
  
  <p><a href="http://prideparrot.com/blog/archive/2012/6/customizing_property_binding_through_attributes" rel="nofollow noreferrer">Solution 2</a></p>
  
  <p><strong>EDIT</strong></p>
  
  <p>The custom input value that comes from view is: <strong>"08/10/2016 - 15/10/2016"</strong></p>