Exemple #1
0
        public ActionResult MessageCreate(ProductMessageRecordModel model)
        {
            if (!_permissionService.Authorize(StandardPermissionProvider.ManagePlugins))
            {
                return(Content("Access denied"));
            }

            if (!ModelState.IsValid)
            {
                return(Configure());
            }

            var productMessageRecord = new ProductMessageRecord
            {
                ProductId       = model.ProductId,
                MessageHtmlCode = model.MessageHtmlCode,
                DisplayOrder    = model.DisplayOrder
            };

            _productMessageRecordService.InsertProductMessageRecord(productMessageRecord);

            SuccessNotification(_localizationService.GetResource("Admin.Plugins.Saved"));

            //redisplay the form
            return(View("~/Plugins/Widgets.MyProductMessage/Views/ProductMessage/MessageCreate.cshtml", model));
        }
        public virtual void DeleteProductMessageRecord(ProductMessageRecord productMessageRecord)
        {
            if (productMessageRecord == null)
            {
                throw new ArgumentNullException("productVideoRecord");
            }

            _productMessageRecordRepository.Delete(productMessageRecord);
        }
        public virtual void InsertProductMessageRecord(ProductMessageRecord productMessageRecord)
        {
            if (productMessageRecord == null)
            {
                throw new ArgumentNullException("productMessageRecord");
            }

            _productMessageRecordRepository.Insert(productMessageRecord);
        }