title: How to automatically populate CreatedDate and ModifiedDate?
body: <p>I am learning ASP.NET Core MVC and my model is</p>
  
  <pre><code>namespace Joukyuu.Models
  {
      public class Passage
      {
          public int PassageId { get; set; }
          public string Contents { get; set; }
  
  
          public DateTime CreatedDate { get; set; }
          public DateTime ModifiedDate { get; set; }
      }
  }
  </code></pre>
  
  <p>The <code>Passage</code> table is used to save passages I wrote.</p>
  
  <h1>Scenario</h1>
  
  <ul>
  <li><p><code>Create</code> view just has one field <code>Contents</code> to input a passage.  <code>CreatedDate</code> and <code>ModifiedDate</code> must be automatically set equal by the server (using UTC format).</p></li>
  <li><p><code>Edit</code> view just has one field <code>Contents</code> to edit a passage. <code>ModifiedDate</code> must be automatically set by the server.</p></li>
  </ul>
  
  <h1>Question</h1>
  
  <p>What attributes I have to attach to the <code>CreatedDate</code> and <code>ModifiedDate</code> properties to make them automatically populated by the server based on the above scenario?</p>