title: How do i encrypt and decrypt in model in asp.net mvc 5
body: <p>I have Model named Users in ASP.NET MVC 5. I have Encrypt() and Decrypt() Extension Methods to Encrypt and Decrypt string respectively. I want to encrypt and decrypt data while sving and fetching from database. So, I used:</p>
  
  <pre><code>private string _mob;
  public string mob
      {
          get
          {
              return _mob.Decrypt();
          }
          set
          {
              _mob = value.Encrypt();
          }
      }
  </code></pre>
  
  <p>But I am unable to achieve my goal. When I use </p>
  
  <pre><code>public string mob
      {
          get
          {
              return _mob;
          }
          set
          {
              _mob = value.Encrypt();
          }
      }
  </code></pre>
  
  <p>I get encryption done but as soon as I add Decrypt() in get{} there is no encryption/decryption done. I see plain text data in database.</p>