title: Custom get and set methods on C#
body: <p>Always when i to save a model, i want set an encrypted password, see the code bellow, it works:</p>
  
  <pre><code> private string _senha;
      public string Senha
      {
          get { return _senha; }
          set
          {
              if (null != value)
              {
                  _senha = BCryptHelper.HashPassword(value, BCryptHelper.GenerateSalt());
              }
          }
      }
  </code></pre>
  
  <p>But in my AuthController to check the password, it don't work, i think that the model is trying encrypt again before do it, what can i do?</p>
  
  <p>My auth:</p>
  
  <pre><code>// POST: Clientes/Login
      [HttpPost]
      public ActionResult Login(FormCollection cliente_params)
      {
          if (ModelState.IsValid)
          {
              string Email = cliente_params["Email"].ToString();
              string Senha = cliente_params["Senha"].ToString();
              bool Remember = Convert.ToBoolean(Convert.ToInt32(cliente_params["Remember"]));
              Cliente cliente = db.Clientes.Where(p =&gt; p.Email.Equals(Email)).FirstOrDefault();
              if (null != cliente)
              {
                  string EncryptedPassword = cliente.Senha;
                  if (BCryptHelper.CheckPassword(Senha, EncryptedPassword))
                  {
                      FormsAuthentication.SetAuthCookie(cliente.Email, Remember);
                      return RedirectToAction("Index", "Home");
                  }
                  else
                  {
                      ModelState.AddModelError("", "Email ou senha incorretos!" + Senha + " - " + EncryptedPassword);
                  }
              }
              else
              {
                  ModelState.AddModelError("", "Email ou senha incorretos!");
              }
          }
          return View();
      }
  </code></pre>