title: Validate function of IValidatableObject not working
body: <p>I have a "Review" Class:</p>
  
  <pre><code>public class Review : IValidatableObject
  {
      public int ReviewId { get; set; }
  
      [DisplayName("Digning Date")]
      [DisplayFormat(DataFormatString = "{0:d}", ApplyFormatInEditMode = true)]
      [DataType(DataType.Date)]
      public DateTime Created { get; set; }
  
      [Range(1, 10)]
      public int Rating { get; set; }
  
      [Required]
      [DataType(DataType.MultilineText)]
      public string Body { get; set; }
      public int RestaurantId { get; set; }
      public virtual Restaurant Resturant { get; set; }
  
      public IEnumerable&lt;ValidationResult&gt; Validate(ValidationContext validationContext)
      {
          var fields = new[]{ "Created"};
  
          if(Created &gt; DateTime.Now)
          {
              yield return new ValidationResult("Created date cannot be in the future.", fields);
          }
  
          if (Created &lt; DateTime.Now.AddYears(-1))
          {
              yield return new ValidationResult("Created date cannot be to far in the past.", fields);
          }
      }
  }
  </code></pre>
  
  <p>which uses Validate method of IValidatableObject to validate Create property. also this is my cshtml code:</p>
  
  <pre><code>@model OdeToFood.Models.Review
  
  @{
  ViewBag.Title = "Create";
  }
  
  &lt;h2&gt;Create&lt;/h2&gt;
  
  @section scripts
   {
  &lt;script src="@Url.Content("~/Scripts/jquery.validate.min.js")" type="text/javascript"&gt;      &lt;/script&gt;
  &lt;script src="@Url.Content("~/Scripts/jquery.validate.unobtrusive.min.js")"    type="text/javascript"&gt;&lt;/script&gt;
  }
  
  @using (Html.BeginForm()) {
  @Html.ValidationSummary(true)
  &lt;fieldset&gt;
      &lt;legend&gt;Review&lt;/legend&gt;
  
      &lt;div class="editor-label"&gt;
          @Html.LabelFor(model =&gt; model.Created)
      &lt;/div&gt;
      &lt;div class="editor-field"&gt;
          @Html.EditorFor(model =&gt; model.Created)
          @Html.ValidationMessageFor(model =&gt; model.Created)
      &lt;/div&gt;
  
      &lt;div class="editor-label"&gt;
          @Html.LabelFor(model =&gt; model.Rating)
      &lt;/div&gt;
      &lt;div class="editor-field"&gt;
          @Html.EditorFor(model =&gt; model.Rating)
          @Html.ValidationMessageFor(model =&gt; model.Rating)
      &lt;/div&gt;
  
      &lt;div class="editor-label"&gt;
          @Html.LabelFor(model =&gt; model.Body)
      &lt;/div&gt;
      &lt;div class="editor-field"&gt;
          @Html.EditorFor(model =&gt; model.Body)
          @Html.ValidationMessageFor(model =&gt; model.Body)
      &lt;/div&gt;
  
      &lt;p&gt;
          &lt;input type="submit" value="Create" /&gt;
      &lt;/p&gt;
  &lt;/fieldset&gt;
  }
  
  &lt;div&gt;
  @Html.ActionLink("Back to List", "Index")
  &lt;/div&gt;
  </code></pre>
  
  <p>The Validate method simply check wether the year of date of Create is in present year(2012) or last year(2011). So if user enter 2000 as year he should get error: "Created date cannot be in the future.". But i does not work!</p>
  
  <p>also this is my configuration in web.config:</p>
  
  <pre><code>&lt;appSettings&gt;
    &lt;add key="webpages:Version" value="1.0.0.0" /&gt;
    &lt;add key="ClientValidationEnabled" value="true" /&gt;
    &lt;add key="UnobtrusiveJavaScriptEnabled" value="true" /&gt;
  &lt;/appSettings&gt;
  </code></pre>
  
  <p>also this my controller code:</p>
  
  <pre><code>    public ActionResult Create()
      {
          return View(new Review());
      } 
  
      //
      // POST: /Reviews/Create
  
      [HttpPost]
      public ActionResult Create(int restaurantId, Review newReview)
      {
          try
          {
              //_db is my DBContext
              var restaurant = _db.Restaurants.Single(r =&gt; r.RestaurantId == restaurantId);
              newReview.Created = DateTime.Now;
  
              restaurant.Reviews.Add(newReview);
              _db.SaveChanges();
  
              return RedirectToAction("Index");
          }
          catch(System.Data.Entity.Validation.DbEntityValidationException ex)
          {
              return View();
          }
      }
  </code></pre>
  
  <p>What i must to do?
  Thanks</p>