コード例 #1
0
        public ActionResult Create()
        {
            if (!_permissionService.Authorize(StandardPermissionProvider.ManageCampaigns))
            {
                return(AccessDeniedView());
            }

            var model    = new CampaignModel();
            var compaign = new Campaign();

            model.Locales = new List <CompaignLocalizedModel>();
            AddLocales(_languageService, model.Locales, (locale, languageId) =>
            {
                locale.Subject = compaign.GetLocalized(x => x.Subject, languageId, false, false);
                locale.Body    = compaign.GetLocalized(x => x.Body, languageId, false, false);
            });
            model.CompaignLanguages = _languageService.GetAllLanguages()
                                      .Select(x => new CompaignLanguage()
            {
                LanguageId   = x.Id,
                LanguageName = x.Name,
                Selected     = false
            }).ToList();
            model.CategoriesTree = new List <TreeViewItemModel>();
            model.CategoriesTree = PrepareTreeView(model.CategoriesTree, 0);
            model.AllowedTokens  = FormatTokens(_messageTokenProvider.GetListOfRecentProductsTokens());
            return(View(model));
        }