title: How to make modified RegisterModel value be inserted into database when registering an user?
body: <p>I want to create a different RegisterModel than the one in MVC 4 template, and make that, when a new user wants to register, they can select wether they want to be "Premium" or not. The thing is I don't know how to pass the checkbox value of IsPremium to the WebSecurity.CreateUserAndAccount method and make it work.</p>
  
  <p><strong>The problem</strong>: When an user wants to register, there is a SQL error saying IsPremium cannot be empty.</p>
  
  <p><strong>The question</strong>: What do I need to modify in order to make the value of the IsPremium chechbox be the value inserted into the database when creating an user?</p>
  
  <p>I haven't been able to find an explanation on how RegisterModel and User are related, this would be good too.</p>
  
  <p>Obviously, the IsPremium is required.</p>
  
  <p>(Removed al [Display] and validation annotations for sake of simplicity:</p>
  
  <pre><code> public class RegisterModel
  {
      public string UserName { get; set; }
      public string Correo { get; set; }
      public string  Twitter { get; set; }
      public string LinkedIn { get; set; }
      public string Perfil { get; set; }
      public bool IsPremium { get; set; }
      public string Password { get; set; }
      public string ConfirmPassword { get; set; }
  }
  </code></pre>
  
  <p>And my User class is:</p>
  
  <pre><code>public class Usuario
  {
      [Key]
      [DatabaseGeneratedAttribute(DatabaseGeneratedOption.Identity)]
      public int UserId { get; set; }
      [EmailAddress]
      public string Correo { get; set; }
      public string UserName { get; set; }
      public string Twitter { get; set; }
      public string Perfil { get; set; }
      public bool IsPremium { get; set; }
      public string LinkedIn { get; set; }
      public List&lt;Evento&gt; Ponencias { get; set; }
      public List&lt;Evento&gt; Asistencias { get; set; }
      public List&lt;Evento&gt; EventosCreados { get; set; }
  }
  </code></pre>
  
  <p>The important part of view for creating a new account is:</p>
  
  <pre><code> &lt;fieldset&gt;
      &lt;legend&gt;Formulario de registro&lt;/legend&gt;
      &lt;ol&gt;
          &lt;li&gt;
              @Html.LabelFor(m =&gt; m.UserName)
              @Html.TextBoxFor(m =&gt; m.UserName)
          &lt;/li&gt;
          &lt;li&gt;
              @Html.LabelFor(m=&gt;m.Correo)
              @Html.TextBoxFor(m=&gt;m.Correo)
          &lt;/li&gt;
          &lt;li&gt;
              @Html.LabelFor(m=&gt;m.Twitter)
              @Html.TextBoxFor(m=&gt;m.Twitter)
          &lt;/li&gt;
          &lt;li&gt;
              @Html.LabelFor(m=&gt;m.LinkedIn)
              @Html.TextBoxFor(m=&gt;m.LinkedIn)
          &lt;/li&gt;
            &lt;li&gt;
              @Html.LabelFor(m=&gt;m.Perfil)
              @Html.TextBoxFor(m=&gt;m.Perfil)
          &lt;/li&gt;
          &lt;li&gt;
              @Html.LabelFor(m=&gt;m.IsPremium)
              @Html.CheckBoxFor(m=&gt;m.IsPremium)
          &lt;/li&gt;
          &lt;li&gt;
              @Html.LabelFor(m =&gt; m.Password)
              @Html.PasswordFor(m =&gt; m.Password)
          &lt;/li&gt;
          &lt;li&gt;
              @Html.LabelFor(m =&gt; m.ConfirmPassword)
              @Html.PasswordFor(m =&gt; m.ConfirmPassword)
          &lt;/li&gt;
      &lt;/ol&gt;
      &lt;input type="submit" value="Registrarse" /&gt;
  &lt;/fieldset&gt;
  </code></pre>
  
  <p>And finally my controller:</p>
  
  <pre><code> public ActionResult Register(RegisterModel model)
      {
          if (ModelState.IsValid)
          {
              try
              {
                  WebSecurity.CreateUserAndAccount(model.UserName, model.Password, model.IsPremium); // THIS IS WHERE I GET AN EXCEPTION
                  WebSecurity.Login(model.UserName, model.Password);
                  return RedirectToAction("Index", "Home");
              }
              catch (MembershipCreateUserException e)
              {
                  ModelState.AddModelError("", ErrorCodeToString(e.StatusCode));
              }
          }
          return View(model);
      }
  </code></pre>
  
  <p>Many thanks.</p>