public IActionResult Edit(NewsItemModel model, bool continueEditing)
        {
            var newsItem = _newsService.GetNewsById(model.Id);

            if (newsItem == null)
            {
                //No news item found with the specified id
                return(RedirectToAction("List"));
            }

            if (ModelState.IsValid)
            {
                newsItem = _newsViewModelService.UpdateNewsItemModel(newsItem, model);
                SuccessNotification(_localizationService.GetResource("Admin.ContentManagement.News.NewsItems.Updated"));

                if (continueEditing)
                {
                    //selected tab
                    SaveSelectedTabIndex();

                    return(RedirectToAction("Edit", new { id = newsItem.Id }));
                }
                return(RedirectToAction("List"));
            }

            //If we got this far, something failed, redisplay form
            ViewBag.AllLanguages = _languageService.GetAllLanguages(true);
            //Store
            model.PrepareStoresMappingModel(newsItem, true, _storeService);
            //ACL
            model.PrepareACLModel(newsItem, true, _customerService);

            return(View(model));
        }
        public IActionResult Create()
        {
            ViewBag.AllLanguages = _languageService.GetAllLanguages(true);
            var model = new NewsItemModel();

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

            //default values
            model.Published     = true;
            model.AllowComments = true;
            //locales
            AddLocales(_languageService, model.Locales);
            //ACL
            model.PrepareACLModel(null, false, _customerService);
            return(View(model));
        }
        public IActionResult Create(NewsItemModel model, bool continueEditing)
        {
            if (ModelState.IsValid)
            {
                var newsItem = _newsViewModelService.InsertNewsItemModel(model);
                SuccessNotification(_localizationService.GetResource("Admin.ContentManagement.News.NewsItems.Added"));
                return(continueEditing ? RedirectToAction("Edit", new { id = newsItem.Id }) : RedirectToAction("List"));
            }

            //If we got this far, something failed, redisplay form
            ViewBag.AllLanguages = _languageService.GetAllLanguages(true);
            //Stores
            model.PrepareStoresMappingModel(null, true, _storeService);
            //ACL
            model.PrepareACLModel(null, true, _customerService);

            return(View(model));
        }