Exemplo n.º 1
0
        public async Task Delete(Concept concept)
        {
            var games = await gameRepository.GetGamesWithConcept(concept.Id);

            if (games.Any())
            {
                string message = $"Games: {string.Join(Environment.NewLine, games.Select(x => $"Created by {x.Owner} in {x.CreationDate.ToShortDateString()} ({x.Percentage})"))}";
                throw new DeleteDependencyException(nameof(Concept), message);
            }

            await conceptRepository.DeleteConcept(concept);

            await unitOfWork.CompleteAsync();
        }