protected override async Task OnSortAsync(IPage sourceItem, IPage destItem, ListItemSortPosition position)
        {
            switch (position)
            {
            case ListItemSortPosition.Before:
                await pageService.UpPagePositionAsync(sourceItem, destItem);

                break;

            case ListItemSortPosition.After:
                await pageService.DownPagePositionAsync(sourceItem, destItem);

                break;
            }
        }
Esempio n. 2
0
        public async Task <IActionResult> SortAsync([FromQuery] string sourceId, [FromQuery] string destId, [FromQuery] ListItemSortPosition destPosition)
        {
            await OnInitializeAsync();

            if (!ModelState.IsValid)
            {
                return(ValidationProblem());
            }

            var sId = ParseId(sourceId);
            var dId = ParseId(destId);

            var sourceItem = await OnGetItemAsync(sId);

            if (sourceItem == null)
            {
                return(BadRequest());
            }

            var destItem = await OnGetItemAsync(dId);

            if (destItem == null)
            {
                return(BadRequest());
            }

            await OnSortAsync(sourceItem, destItem, destPosition);

            return(Ok());
        }
Esempio n. 3
0
 protected virtual Task OnSortAsync(TItem sourceItem, TItem destItem, ListItemSortPosition position)
 {
     return(Task.CompletedTask);
 }