private async void OnRemoveExecute()
        {
            var isReferenced = await _programmingLanguageRepository.IsReferencedByFriendAsync(SelectedProgrammingLanguage.Id);

            if (isReferenced)
            {
                MessageDialogeService.ShowInfoDialog($"The language {SelectedProgrammingLanguage.Name} is already a favorite language for a friend it's cannot be deleted");
                return;
            }
            SelectedProgrammingLanguage.PropertyChanged -= Wrapper_PropertyChanged;
            _programmingLanguageRepository.Delete(SelectedProgrammingLanguage.Model);
            ProgrammingLanguages.Remove(SelectedProgrammingLanguage);
            SelectedProgrammingLanguage = null;
            HasChanged = _programmingLanguageRepository.HasChanges();
            ((DelegateCommand)SaveCommand).RaiseCanExecuteChanged();
        }
예제 #2
0
        public void RemoveProgrammingLanguage(int id)
        {
            var language = programmingLanguageRepository.GetById(id);

            programmingLanguageRepository.Delete(language);
        }