private void save_Click(object sender, RoutedEventArgs e) { if (nikName.Text != user.NikName || firstname.Text != user.FirstName || surname.Text != user.SurName || phone.Text != user.Phone) { if (String.IsNullOrEmpty(nikName.Text) || String.IsNullOrEmpty(firstname.Text) || String.IsNullOrEmpty(surname.Text) || String.IsNullOrEmpty(phone.Text)) { error.Text = "Error in empty cells cannot be"; } else { var help = rollingMachinesContext.GetUsers(nikName.Text); if (help.Count == 0) { user.NikName = nikName.Text; user.FirstName = user.FirstName; user.SurName = surname.Text; user.Phone = phone.Text; rollingMachinesContext.Update <User>(user); rollingMachinesContext.SaveChanges(); } else { error.Text = "THIS NIKNAME NOT GOOD"; } } } }
private void registration_Click(object sender, RoutedEventArgs e) { if (password1.Text != password2.Text) { error.Text = "Error Password not the Same"; } else { if ((String.IsNullOrEmpty(nikname.Text) || String.IsNullOrEmpty(firstname.Text) || String.IsNullOrEmpty(surname.Text) || String.IsNullOrEmpty(phone.Text) || String.IsNullOrEmpty(password1.Text))) { error.Text = "Error in empty cells cannot be"; } else { var help = rollingMachinesContext.GetUsers(nikname.Text); if (help.Count == 0) { User user = new User(); user.NikName = nikname.Text; user.FirstName = firstname.Text; user.SurName = surname.Text; user.Phone = phone.Text; user.Password = password1.Text; rollingMachinesContext.AddUser(user); BasicWindow basicWindow = new BasicWindow(user); basicWindow.Show(); this.Close(); } else { error.Text = "THIS NIKNAME NOT GOOD"; } } } }