public ActionResult NewsCatalogueInsert(NewsItemModel.NewsCatalogueModel model) { if (!_permissionService.Authorize(StandardPermissionProvider.ManageNews)) { return(AccessDeniedView()); } var newsId = model.NewsId; var catalogueId = model.CatalogueId; var existingNewsCatalogues = _catalogueService.GetNewsCataloguesByCatalogueId(catalogueId, 0, int.MaxValue, true); if (existingNewsCatalogues.FindNewsCatalogues(newsId, catalogueId) == null) { var newsCatalogue = new NewsCatalogues { NewsId = newsId, CatalogueId = catalogueId, DisplayOrder = model.DisplayOrder }; _catalogueService.InsertNewsCatalogues(newsCatalogue); } return(new NullJsonResult()); }
public ActionResult NewsCatalogueUpdate(NewsItemModel.NewsCatalogueModel model) { if (!_permissionService.Authorize(StandardPermissionProvider.ManageNews)) { return(AccessDeniedView()); } var newsCatalogue = _catalogueService.GetNewsCataloguesById(model.Id); if (newsCatalogue == null) { throw new ArgumentException("No news catalogue mapping found with the specified id"); } newsCatalogue.CatalogueId = model.CatalogueId; newsCatalogue.DisplayOrder = model.DisplayOrder; _catalogueService.UpdateNewsCatalogues(newsCatalogue); return(new NullJsonResult()); }