Beispiel #1
0
        public async Task <IActionResult> DeleteChallenge(string challengeId)
        {
            var challengeResponse = await challengeProvider.GetItemAsync(challengeId);

            await challengeProvider.DeleteItemAsync(challengeId);

            await challengeParameterProvider.DeleteItemAsync(challengeId);

            await assignedQuestionProvider.DeleteAllItemsOfChallenge(challengeId);

            if (challengeResponse.Item2.IsPublic)
            {
                // We only have one, so just get via the Partition search
                var aggregatesReponse = await aggregateProvider.GetItemAsync("00000000-0000-0000-0000-000000000000");

                if (aggregatesReponse.Item1.Success)
                {
                    aggregatesReponse.Item2.ChallengeTotals.TotalPublic -= 1;

                    await aggregateProvider.AddItemAsync(aggregatesReponse.Item2);
                }
            }

            return(Ok());
        }