public ActionResult ExtraContentEdit(NewsItemExtraContentModel model) { var newsItem = _newsService.GetNewsById(model.NewsItemId); if (newsItem == null) { //No newsItem found with the specified id return(RedirectToAction("List")); } var extraContent = _extraContentService.GetExtraContentById(model.ExtraContent.Id); if (extraContent == null) { //No etracontent found with the specified id return(RedirectToAction("Edit", new { id = newsItem.Id })); } if (ModelState.IsValid) { extraContent = model.ExtraContent.ToEntity(extraContent); _extraContentService.UpdateExtraContent(extraContent); SuccessNotification(_localizationService.GetResource("Admin.News.ExtraContents.Updated")); return(RedirectToAction("ExtraContentEdit", new { newsItemId = model.NewsItemId, extraContentId = model.ExtraContent.Id })); } //If we got this far, something failed, redisplay form model.NewsItemId = newsItem.Id; model.ExtraContent = extraContent.ToModel(); return(View(model)); }
public ActionResult ExtraContentCreate(NewsItemExtraContentModel model) { if (!_permissionService.Authorize(StandardPermissionProvider.ManageCustomers)) { return(AccessDeniedView()); } var newsItem = _newsService.GetNewsById(model.NewsItemId); if (newsItem == null) { //No newsItem found with the specified id return(RedirectToAction("List")); } if (ModelState.IsValid) { var extraContent = model.ExtraContent.ToEntity(); newsItem.AddExtraContent(extraContent); _newsService.UpdateNews(newsItem); SuccessNotification(_localizationService.GetResource("Admin.NewsItems.ExtraContents.Added")); return(RedirectToAction("ExtraContentEdit", new { extraContentId = extraContent.Id, newsItemId = model.NewsItemId })); } //If we got this far, something failed, redisplay form model.NewsItemId = newsItem.Id; return(View(model)); }
public ActionResult ExtraContentEdit(int extraContentId, int newsItemId) { if (!_permissionService.Authorize(StandardPermissionProvider.ManageNews)) { return(AccessDeniedView()); } var newsItem = _newsService.GetNewsById(newsItemId); if (newsItem == null) { //No newsItem found with the specified id return(RedirectToAction("List")); } var extraContent = _extraContentService.GetExtraContentById(extraContentId); if (extraContent == null) { //No etracontent found with the specified id return(RedirectToAction("Edit", new { id = newsItem.Id })); } var model = new NewsItemExtraContentModel(); model.NewsItemId = newsItemId; model.ExtraContent = extraContent.ToModel(); return(View(model)); }
public ActionResult ExtraContentCreate(int newsItemId) { if (!_permissionService.Authorize(StandardPermissionProvider.ManageCustomers)) { return(AccessDeniedView()); } var newsItem = _newsService.GetNewsById(newsItemId); if (newsItem == null) { //No customer found with the specified id return(RedirectToAction("List")); } var model = new NewsItemExtraContentModel(); model.ExtraContent = new ExtraContentModel(); model.NewsItemId = newsItemId; return(View(model)); }