title: Check if datetime existing in database mvc 5
body: <p>I'm using MVC 5 and I want to make validation to check if DateOfEvent existing in database and I'm using remote validation but it's not working.  I want to see like this output
  <a href="https://i.stack.imgur.com/chXMH.png" rel="nofollow noreferrer">enter image description here</a></p>
  
  <p>I'm using sql server and this is my database
  <a href="https://i.stack.imgur.com/Bptkq.png" rel="nofollow noreferrer">enter image description here</a></p>
  
  <p><strong>Model</strong></p>
  
  <pre><code>public partial class tblEvent
  {
      public int EventId { get; set; }
      public string Descripstions { get; set; }
  
      [Display(Name = "DateOfEvent")]
      [DisplayFormat(DataFormatString = "{0:dd-MMM-yyyy hh:mm tt}", ApplyFormatInEditMode = true)]
      //Using Remote validation attribute   
      [Remote("IsDateOfEventAlreadySigned", "Event", HttpMethod = "POST", ErrorMessage = "Date Of Event already exists in database.")]
      public DateTime? DateOfEvent { get; set; }
  
      [Display(Name = "EmpName")]
      [Remote("IsEmpNameAlreadySigned", "Event", HttpMethod = "POST", ErrorMessage = "EmpName already exists in database.")]
      public string EmpName { get; set; }
  }
  </code></pre>
  
  <p><strong>Controller</strong></p>
  
  <pre><code>public class EventController : Controller
  {
      [HttpPost]
      public JsonResult IsDateOfEventAlreadySigned(DateTime? DateOfEvent)
      {
          return Json(db.tblEvents.Any(u =&gt; u.DateOfEvent == DateOfEvent), JsonRequestBehavior.AllowGet);
      }
  
      [HttpPost]
      public JsonResult IsEmpNameAlreadySigned(string EmpName)
      {
          return Json(!db.tblEvents.Any(u =&gt; u.EmpName == EmpName), JsonRequestBehavior.AllowGet);
      }
  
      private MyDatabaseEntities db = new MyDatabaseEntities();
  </code></pre>