Пример #1
0
        private void CloseAddEditModal(PlannerItemModel item)
        {
            if (onSaveCallback != null)
            {
                onSaveCallback.Invoke(item);
                onSaveCallback = null;
            }

            modalService.Close();
        }
Пример #2
0
        public void BeginAddingCategory(Action <CategoryModel> onSave)
        {
            var modalBody = new RenderFragment(builder =>
            {
                builder.OpenComponent <CategoryForm>(0);
                builder.AddAttribute(1, "Category", new CategoryModel());
                builder.AddAttribute(2, "OnSaveCallback", EventCallback.Factory.Create <CategoryModel>(this, (CategoryModel savedItem) =>
                {
                    modalService.Close();
                    onSave?.Invoke(savedItem);
                }));
                builder.CloseComponent();
            });

            modalService.Show(new ModalParams(modalBody, style: ModalStyle.Normal));
        }