private void UpdateBtn_Click(object sender, RoutedEventArgs e) { if (tp.Where(t => t.ID.Equals(Idtext.Text)).Any() == true) { ///tp.Where(w => w.ID == Idtext.Text).ToList().ForEach(s => s.ID = Idtext.Text); tp.Where(w => w.ID == Idtext.Text).ToList().ForEach(s => s.Description = Descriptiontext.Text); tp.Where(w => w.ID == Idtext.Text).ToList().ForEach(s => s.Version = Versiontext.Text); tp.Where(w => w.ID == Idtext.Text).ToList().ForEach(s => s.Name = Nametext.Text); tp.Where(w => w.ID == Idtext.Text).ToList().ForEach(s => s.Logo = Logotext.Text); } Nametext.Clear(); Idtext.Clear(); Versiontext.Clear(); Descriptiontext.Clear(); Logotext.Clear(); Idtext.IsReadOnly = false; }
private void SaveDetails(object sender, RoutedEventArgs e) { if (tp.Where(t => t.ID.Equals(Idtext.Text)).Any() == false) { tp.Add(new NewTestPlan { Name = Nametext.Text, ID = Idtext.Text, Version = Versiontext.Text, Description = Descriptiontext.Text, Logo = Logotext.Text }); Nametext.Clear(); Idtext.Clear(); Versiontext.Clear(); Descriptiontext.Clear(); Logotext.Clear(); } else { MessageBox.Show("With this ID already details are exist you can update only"); Idtext.IsReadOnly = true; } }