public async Task Create(MLangWord item) { await langWordDS.Create(item); WordItemsAll.Add(item); ApplyFilters(); }
public async Task Create(MUnitWord item) { int id = await unitWordDS.Create(item); var o = await unitWordDS.GetDataById(id, vmSettings.Textbooks); o?.CopyProperties(item); if (item.NOTE.IsEmpty()) { await RetrieveNote(item); } WordItemsAll.Add(o); ApplyFilters(); }
public MUnitWord NewUnitWord() { var maxElem = WordItemsAll.IsEmpty() ? null : WordItemsAll.MaxBy(o => (o.UNIT, o.PART, o.SEQNUM)).First(); return(new MUnitWord { LANGID = vmSettings.SelectedLang.ID, TEXTBOOKID = vmSettings.USTEXTBOOK, UNIT = maxElem?.UNIT ?? vmSettings.USUNITTO, PART = maxElem?.PART ?? vmSettings.USPARTTO, SEQNUM = (maxElem?.SEQNUM ?? 0) + 1, Textbook = vmSettings.SelectedTextbook, }); }
void ApplyFilters() { WordItems = NoFilter ? WordItemsAll : new ObservableCollection <MUnitWord>(WordItemsAll.Where(o => (string.IsNullOrEmpty(TextFilter) || (ScopeFilter == "Word" ? o.WORD : o.NOTE).ToLower().Contains(TextFilter.ToLower())) && (TextbookFilter == 0 || o.TEXTBOOKID == TextbookFilter) )); this.RaisePropertyChanged(nameof(WordItems)); }
protected virtual void ApplyFilters() { WordItems = string.IsNullOrEmpty(TextFilter) ? WordItemsAll : new ObservableCollection <MLangWord>(WordItemsAll.Where(o => string.IsNullOrEmpty(TextFilter) || (ScopeFilter == "Word" ? o.WORD : o.NOTE).ToLower().Contains(TextFilter.ToLower()) )); this.RaisePropertyChanged(nameof(WordItems)); }