public void setValueMyAccount(User user) { currentUser.InnerHtml = user.LastName; txtFirstNameUpdate.Value = user.FirstName; txtLastNameUpdate.Value = user.LastName; txtMobileUpdate.Value = user.Phone; txtEmailUpdate.Value = user.Email; txtAddressUpdate.Value = user.Address; lblLastModified.InnerText = user.LastModified.ToString(); }
protected void btnSignUp_Click(object sender, EventArgs e) { User userSignUp = db.Users.Where(n => n.Email == txtEmailSignUp.Value).SingleOrDefault(); if(userSignUp != null) { lblMessageSignUp.InnerText = "Email has already existed"; return; } User user = new User(); user.Email = txtEmailSignUp.Value; user.Phone = txtMobileSignUp.Value; user.FirstName = txtFirstNameSignUp.Value; user.LastName = txtLastNameSignUp.Value; user.Password = MD5.encrypt(txtPasswordSignUp.Value); user.Address = txtAddressSignUp.Value; db.Users.Add(user); db.SaveChanges(); Session["User"] = user; Response.Redirect("Home.aspx"); }