コード例 #1
0
        private async Task UpdateArticle(ArticleEditDto articleDto)
        {
            var article = FromDtoToModel(articleDto);

            // Get the associations that already exist for this article.
            // This would include both squads and the club association.
            var clubArticles = await _articlesRepository.GetClubAssociationsForArticleId(articleDto.Id);

            var squadArticles = await _articlesRepository.GetSquadAssociationsForArticleId(articleDto.Id);

            var instructions = CreateArticleAssociationInstructions(articleDto, clubArticles, squadArticles);
            var articlesTo   = ExtractArticleCollectionsFor(instructions);

            await _articlesRepository.UpdateWithAssociations(
                article, articlesTo.CreateForClub, articlesTo.DeleteForClub,
                articlesTo.CreateForSquad, articlesTo.DeleteForSquad);
        }