コード例 #1
0
        private Task MoveUp(ReportSourceColumnDto item, int index)
        {
            if (index == 0)
            {
                return(Task.CompletedTask);
            }

            SelectedTable.UpdateAt(index, SelectedTable.GetAt(index - 1));
            SelectedTable.UpdateAt(index - 1, item);
            return(Task.CompletedTask);
        }
コード例 #2
0
        public static async Task AddEditLaunchAsync(IModalService modalService, SmartishTable.Root <LaunchDto> table, int index, RocketDto?rocketDto = null)
        {
            if (table == null || table.SafeList == null)
            {
                return;
            }

            var       isNew = index == -1;
            LaunchDto?dto   = null;

            if (!isNew)
            {
                dto = table.GetAt(index);
            }
            var parameters = new Blazored.Modal.ModalParameters();

            parameters.Add(nameof(LaunchAddEdit.DtoOriginal), dto);
            if (rocketDto != null)
            {
                parameters.Add(nameof(LaunchAddEdit.SelectedRocketId), rocketDto.RocketId);
            }
            parameters.Add(nameof(LaunchAddEdit.InitialLaunchNumber), (rocketDto?.NumberOfLaunches ?? 0) + 1);
            var modalReference = modalService.Show <LaunchAddEdit>("Launch Add/Edit", parameters, new ModalOptions()
            {
            });
            var modalResult = await modalReference.Result;

            dto = modalResult.Data as LaunchDto;
            if (dto != null)
            {
                if (isNew)
                {
                    await table.Add(dto);
                }
                else
                {
                    await table.UpdateAt(index, dto);
                }

                if (rocketDto != null && dto.LaunchNumber > rocketDto.NumberOfLaunches)
                {
                    rocketDto.NumberOfLaunches = dto.LaunchNumber;
                }
            }
        }
コード例 #3
0
        public static async Task AddEditRocketAsync(IModalService modalService, SmartishTable.Root <RocketDto> table, int index)
        {
            if (table == null || table.SafeList == null)
            {
                return;
            }

            var       isNew = index == -1;
            RocketDto?dto   = null;

            if (!isNew)
            {
                dto = table.GetAt(index);
            }

            var parameters = new Blazored.Modal.ModalParameters();

            parameters.Add(nameof(RocketAddEdit.DtoOriginal), dto);
            var modalReference = modalService.Show <RocketAddEdit>("Rocket Add/Edit", parameters, new ModalOptions()
            {
            });
            var modalResult = await modalReference.Result;

            dto = modalResult.Data as RocketDto;
            if (dto != null)
            {
                if (isNew)
                {
                    await table.Add(dto);
                }
                else
                {
                    await table.UpdateAt(index, dto);
                }
            }
        }