private void AdaugaInstitutie() { var win = new InstitutieDetail(new InstitutieAsociataViewModel()); win.Show(); win.ViewModel.InstitutieAdded += (sender, args) => { var inst = args; Institutii.Add(new InstitutieAsociataViewModel(inst)); win.Close(); }; }
private void UpdateInstitutie() { if (SelectedInstitutie == null) { MessageBox.Show("Selecteaza o Institutie", "Atentie", MessageBoxButton.OK, MessageBoxImage.Information); } else { var win = new InstitutieDetail(SelectedInstitutie); win.Show(); win.ViewModel.InstitutieUpdated += (sender, args) => { var newInst = args; Institutii.ToList().ForEach(x => { if (x.Id == newInst.Id) { var numeInst = newInst.Nume; var telInst = newInst.NumarTelefon; var email = newInst.Email; var tip = newInst.TipInstitutie; var idAdresa = newInst.Adresa; var adresa = newInst.Adresa1; x.Nume = numeInst; x.NrTel = telInst; x.Email = email; x.Tip = tip; x.IdAdresa = idAdresa; x.Adresa = adresa; } }); win.Close(); }; } }