Пример #1
0
        private void addNewBookBtn_Click(object sender, EventArgs e)
        {
            var item   = _coloringBookRepo.GetForAdd();
            var dialog = new ColoringBookDialog(item, false);

            if (dialog.ShowDialog() == DialogResult.OK)
            {
                _coloringBookRepo.Add(dialog.Item);
                reloadColoringBooks();
            }
        }
Пример #2
0
        private void editBookBtn_Click(object sender, EventArgs e)
        {
            var selected = coloringBooksLv.SelectedIndices;

            if (selected.Count == 1)
            {
                var selectedIndex = selected[0];
                var item          = _coloringBookRepo.GetForEdit(_coloringBooksIds[selectedIndex]);
                if (item == null)
                {
                    return;
                }
                var dialog = new ColoringBookDialog(item, true);
                var result = dialog.ShowDialog();
                if (result == DialogResult.OK)
                {
                    _coloringBookRepo.Edit(dialog.Item);
                    reloadColoringBooks();
                }
            }
        }