private async void OnAddFaculty() { SelectedFaculty.FacultyId = 0; var facultyNames = (await _repo.GetFacultiesAsync()).Select(f => f.Name).ToList(); if (facultyNames.Contains(SelectedFaculty.Name)) { MessageBox.Show("Факульте с таким именем уже существует.", "Ошибка"); return; } var result = await _repo.AddFacultyAsync(SelectedFaculty); Faculties.Add(result); }
public async Task LoadDataLists() { Faculties = new ObservableCollection <Faculty>(await _fRepo.GetFacultiesAsync()); Specialities = new ObservableCollection <Specialty>(await _repo.GetSpecialtiesWithFacultyAsync()); }