예제 #1
0
        private async Task <ArticleEditDto> GetForEditAsDto(int id)
        {
            var article = await _articlesRepository.GetById(id);

            var articleEditDto = FromModelToEditDto(article);

            // Build possible associations..
            await AddAssociationsToArticleEditDto(articleEditDto);

            // Update to indicate if already associated..
            var squadArticles = await _articlesRepository.GetSquadAssociationsForArticleId(id);

            MapSelectionFromSquadArticlesToAssociations(squadArticles, articleEditDto.Associations);

            var clubArticles = await _articlesRepository.GetClubAssociationsForClubId(id);

            MapSelectionFromClubArticlesToAssociations(clubArticles, articleEditDto.Associations);

            return(articleEditDto);
        }