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

            var nextQuestStep = await questRepository.GetNextQuestStepAsync(questStep.QuestKey, questStep.SortOrder);

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