コード例 #1
0
        public void CopySocialMediaAccounts(int sourceEditionId, string languageCode, EditionTranslationEntity targetEditionTranslation)
        {
            var socialMedias = _editionTranslationSocialMediaServices.GetByEdition(sourceEditionId, languageCode);

            foreach (var sm in socialMedias)
            {
                var clonedEntity = (EditionTranslationSocialMediaEntity)sm.Clone();
                clonedEntity.EditionId            = targetEditionTranslation.EditionId;
                clonedEntity.EditionTranslationId = targetEditionTranslation.EditionTranslationId;
                _editionTranslationSocialMediaServices.Create(clonedEntity, Constants.AutoIntegrationUserId);
            }
        }
        public ActionResult _GetSocialMedias(int editionTranslationId)
        {
            var editionTranslation = EditionTranslationServices.GetEditionTranslationById(editionTranslationId);

            if (editionTranslation == null)
            {
                return(PartialView("_EditionSocialMedias", new EditionSocialMediaListModel()));
            }

            var socialMedias = EditionTranslationSocialMediaServices.GetByEdition(editionTranslation.EditionId, editionTranslation.LanguageCode);

            var model = new EditionSocialMediaListModel
            {
                EditionTranslationId = editionTranslation.EditionTranslationId,
                EditionId            = editionTranslation.EditionId,
                SocialMedias         = socialMedias.OrderBy(x => x.SocialMediaId).ToList()
            };

            ViewBag.SocialMediaTypes = SocialMediaServices.GetAllSocialMedias().OrderBy(x => x.SocialMediaId);

            return(PartialView("_EditionSocialMedias", model));
        }