Exemple #1
0
        /// <summary>
        /// Moves the quest step with the given key on place up (and changes the previous quest step.
        /// </summary>
        /// <param name="questStepKey">Unique identifier of the quest step.</param>
        /// <returns>An awaitable task that yields no retrun value.</returns>
        public async Task MoveDownAsync(Guid questStepKey)
        {
            var questStep = await questRepository.GetQuestStepAsync(questStepKey);

            var previousQuestStep = await questRepository.GetPreviousQuestStepAsync(questStep.QuestKey, questStep.SortOrder);

            if (previousQuestStep == null)
            {
                return;
            }
            previousQuestStep.SortOrder++;
            questRepository.Save(previousQuestStep, ctx => ctx.QuestStep, qs => qs.QuestStepKey == previousQuestStep.QuestStepKey);
            questStep.SortOrder--;
            questRepository.Save(questStep, ctx => ctx.QuestStep, qs => qs.QuestStepKey == questStep.QuestStepKey);
        }