public ActionResult EditBrandNotification(EditBrandNotificationViewModel model)
        {
            var message = mc_ExceptionMessage_Error;
            var uvm     = GetCurrentUserViewModel();

            if (!uvm.AvailableSubBrands.Any(x => x.Key == model.SubBrandId))
            {
                Response.StatusCode = (int)System.Net.HttpStatusCode.MethodNotAllowed;
                return(Json(mc_ExceptionMessage_NoAccess, JsonRequestBehavior.AllowGet));
            }

            try
            {
                model.Recipients   = StripHtmlWrapper(HttpUtility.UrlDecode(model.Recipients));
                model.EmailSubject = StripHtmlWrapper(HttpUtility.UrlDecode(model.EmailSubject));
                model.EmailBody    = HttpUtility.UrlDecode(model.EmailBody);

                if (!ValidateRecipients(model.Recipients))
                {
                    ModelState.AddModelError("Recipients", "The Recipients field is not a valid e-mail address.");
                }

                if (ModelState.IsValid)
                {
                    _notificationService.UpdateSubBrandNotification(model.SubBrandId, model.Recipients, model.EmailSubject, model.EmailBody, uvm.Name);

                    message = "Brand Notification was successfully updated.";
                    ViewBag.DialogResult = BuildDialogResult(true, message);
                    return(PartialView("_EditBrandNotification", model));
                }
            }
            catch (Exception ex)
            {
                _log.Error(FormatException(ex));
                Response.StatusCode = (int)System.Net.HttpStatusCode.InternalServerError;
                return(Json(message, JsonRequestBehavior.AllowGet));
            }

            ViewBag.DialogResult = BuildDialogResult(false, message);
            return(PartialView("_EditBrandNotification", model));
        }
        public ActionResult EditBrandNotification(int subBrandId)
        {
            var uvm = GetCurrentUserViewModel();

            if (!uvm.AvailableSubBrands.Any(x => x.Key == subBrandId))
            {
                Response.StatusCode = (int)System.Net.HttpStatusCode.MethodNotAllowed;
                return(Json(mc_ExceptionMessage_NoAccess, JsonRequestBehavior.AllowGet));
            }

            var notification = _notificationService.GetSubBrandNotification(subBrandId);

            var model = new EditBrandNotificationViewModel()
            {
                SubBrandId   = subBrandId,
                EmailBody    = notification.EmailBody,
                EmailSubject = notification.EmailSubject,
                Recipients   = notification.Recipients
            };

            return(PartialView("_EditBrandNotification", model));
        }