public IActionResult Create()
        {
            var model = new NewsletterCategoryModel();

            //locales
            AddLocales(_languageService, model.Locales);
            //Stores
            model.PrepareStoresMappingModel(null, false, _storeService);
            return(View(model));
        }
        public async Task <IActionResult> Create()
        {
            var model = new NewsletterCategoryModel();

            //locales
            await AddLocales(_languageService, model.Locales);

            //Stores
            await model.PrepareStoresMappingModel(null, _storeService, false);

            return(View(model));
        }
        public IActionResult Create(NewsletterCategoryModel model, bool continueEditing)
        {
            if (ModelState.IsValid)
            {
                var newsletterCategory = model.ToEntity();
                _newsletterCategoryService.InsertNewsletterCategory(newsletterCategory);
                SuccessNotification(_localizationService.GetResource("Admin.Promotions.NewsletterCategory.Added"));
                return(continueEditing ? RedirectToAction("Edit", new { id = newsletterCategory.Id }) : RedirectToAction("List"));
            }

            //Stores
            model.PrepareStoresMappingModel(null, false, _storeService);

            return(View(model));
        }
        public async Task <IActionResult> Edit(NewsletterCategoryModel model, bool continueEditing)
        {
            var newsletterCategory = await _newsletterCategoryService.GetNewsletterCategoryById(model.Id);

            if (newsletterCategory == null)
            {
                return(RedirectToAction("List"));
            }

            if (ModelState.IsValid)
            {
                newsletterCategory = model.ToEntity(newsletterCategory);
                await _newsletterCategoryService.UpdateNewsletterCategory(newsletterCategory);

                SuccessNotification(_localizationService.GetResource("Admin.Promotions.NewsletterCategory.Updated"));
                return(continueEditing ? RedirectToAction("Edit", new { id = newsletterCategory.Id }) : RedirectToAction("List"));
            }
            //Stores
            await model.PrepareStoresMappingModel(newsletterCategory, _storeService, true);

            return(View(model));
        }