private void OnAddCommand(object param) { AddBox box = new AddBox(); box.ShowDialog(); string result = box.GetResult; if (!string.IsNullOrWhiteSpace(result)) { Section section = _database.GetSections(_currentBookId).Where(f => f.Name == result).FirstOrDefault(); if (section == null) { section = new Section() { Name = result, Description = "", Book = _currentBookId }; _database.AddSection(section); Sections.Add(section); PropertyChanged.Invoke(this, new PropertyChangedEventArgs(nameof(Sections))); } } }
private void OnAddCommand(object param) { AddBox box = new AddBox(); box.ShowDialog(); string result = box.GetResult; if (!string.IsNullOrWhiteSpace(result)) { Page page = _database.GetPages(_currentSectionId).Where(f => f.Name == result).FirstOrDefault(); if (page == null) { page = new Page() { Name = result, Description = "", Text = "", Section = _currentSectionId }; _database.AddPage(page); Pages.Add(page); PropertyChanged.Invoke(this, new PropertyChangedEventArgs(nameof(Pages))); } } }
protected void OnAddCommand(object param) { AddBox box = new AddBox(); box.ShowDialog(); string result = box.GetResult; if (!string.IsNullOrWhiteSpace(result)) { Book book = _database.GetBooks(currentUser.ID).Where(f => f.Name == result).FirstOrDefault(); if (book == null) { book = new Book() { Name = result, Autor = currentUser.ID }; _database.AddBook(book); Books.Add(book); } } }