public void Register(User user)
 {
     if( GetUser(user.Username) != null )
         throw new ArgumentException("User already exists.");
     _session.Store(user);
     _session.SaveChanges();
 }
        protected void CreateUserButton_Click(object sender, EventArgs e)
        {
            var user = new User
                           {
                               Username = UserName.Text,
                               Password = Password.Text,
                               Email = Email.Text,
                               TraktUser = new TraktUser
                                               {
                                                   UserName = TraktUsername.Text,
                                                   ApiKey = TraktApiKey.Text
                                               }
                           };

            try
            {
                UserRepository.Register(user);
                FormsAuthentication.RedirectFromLoginPage(user.Username, true);
            }
            catch(Exception ex)
            {
                Validators.Add(new CustomValidator { IsValid = false, Text = ex.Message });
                Page.Validate();
            }
        }
Esempio n. 3
0
 public void Upload(User user, string filename, byte[] data)
 {
 }