public ActionResult EditLevelNotification(EditLevelNotificationViewModel 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.CallText     = StripHtmlWrapper(HttpUtility.UrlDecode(model.CallText));
                model.EmailSubject = StripHtmlWrapper(HttpUtility.UrlDecode(model.EmailSubject));
                model.EmailBody    = HttpUtility.UrlDecode(model.EmailBody);

                if (ModelState.IsValid)
                {
                    _notificationService.UpdateLevelNotification(model.SubBrandId, model.Level, model.EmailSubject, model.EmailBody, model.CallText, uvm.Name);
                    message = String.Format("Level {0} Notification was successfully updated.", model.Level);
                    ViewBag.DialogResult = BuildDialogResult(true, message);
                    return(PartialView("_EditLevelNotification", 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("_EditLevelNotification", model));
        }
        public ActionResult EditLevelNotification(int subBrandId, int level)
        {
            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.GetLevelNotification(subBrandId, level);
            var model        = new EditLevelNotificationViewModel()
            {
                Level      = level,
                SubBrandId = subBrandId
            };

            if (notification != null)
            {
                model.NotificationId = notification.NotificationID;
                model.CallText       = notification.CallText;
                model.EmailBody      = notification.EmailBody;
                model.EmailSubject   = notification.EmailSubject;
            }

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