예제 #1
0
        void CancelChild()
        {
            _child = new CategoryDescriptorModel();

            if (Readonly)
            {
                childrenEditingEnabled = false;
            }

            StateHasChanged();
        }
예제 #2
0
        void CancelParent()
        {
            ParentCategory = new CategoryDescriptorModel
            {
                Code = _originalParent.Code,
                Id   = _originalParent.Id,
                Name = _originalParent.Name
            };

            if (Readonly)
            {
                parentEditingEnabled = false;
            }

            StateHasChanged();
        }
예제 #3
0
        async Task RemoveChild(CategoryDescriptorModel child)
        {
            try
            {
                await Client.DeleteCategoryChild(_CategoryId, child.Id);

                category.Children.Remove(child);
            }
            catch
            {
                errorRaised = true;
            }
            finally
            {
                StateHasChanged();
            }
        }
예제 #4
0
        async Task SetParent(CategoryDescriptorModel parent)
        {
            try
            {
                await Client.AddCategoryParent(_CategoryId, parent.Id);

                category.Parent = parent;
            }
            catch
            {
                errorRaised = true;
            }
            finally
            {
                StateHasChanged();
            }
        }
예제 #5
0
        async Task RemoveParent(CategoryDescriptorModel parent)
        {
            try
            {
                await Client.DeleteCategoryParent(_CategoryId, parent.Id);

                category.Parent = new CategoryDescriptorModel();
            }
            catch
            {
                errorRaised = true;
            }
            finally
            {
                StateHasChanged();
            }
        }
예제 #6
0
        protected override Task OnInitializedAsync()
        {
            parentContext   = new EditContext(ParentCategory);
            childrenContext = new EditContext(Children);

            parentEditingEnabled   = !Readonly;
            childrenEditingEnabled = !Readonly;

            _parentIsEmpty  = ParentCategory.IsEmpty;
            _originalParent = new CategoryDescriptorModel
            {
                Code = ParentCategory.Code,
                Id   = ParentCategory.Id,
                Name = ParentCategory.Name
            };

            return(base.OnInitializedAsync());
        }
예제 #7
0
 async Task RemoveChild(CategoryDescriptorModel child) => await OnChildRemoved.InvokeAsync(child);
예제 #8
0
        async Task AddChild()
        {
            await OnChildAdded.InvokeAsync(_child);

            _child = new CategoryDescriptorModel();
        }