public ActionResult _AddSensitiveWord(SensitiveWordEditModel model, WordFilterStatus select)
        {
            if (select.EnumMetadataDisplay() == WordFilterStatus.Banned.EnumMetadataDisplay())
            {
                model.Replacement = "{Banned}";
            }
            if (model.Id == 0 || model.Id == null)
            {
                string[] words = model.Word.Split(new string[] { "\r", "\n" }, StringSplitOptions.RemoveEmptyEntries);

                foreach (var word in words)
                {
                    model.Word = word;

                    int judge = sensitiveWordService.Create(model.AsSensitiveWord());

                    if (judge == -1)
                        return Json(new StatusMessageData(StatusMessageType.Error, "有重名的敏感词!"));
                }
                return Json(new StatusMessageData(StatusMessageType.Success, "添加成功!"));
            }
            else
            {
                int judge = sensitiveWordService.Update(model.AsSensitiveWord());

                if (judge == -1)
                    return Json(new StatusMessageData(StatusMessageType.Error, "敏感词不能同名,编辑失败!"));

                return Json(new StatusMessageData(StatusMessageType.Success, "编辑成功!"));
            }
        }
 public ActionResult _AddSensitiveWord(int? id = null)
 {
     if (id == null)
     {
         SensitiveWordEditModel model = new SensitiveWordEditModel();
         IEnumerable<SensitiveWordType> sensitiveWordTypes = sensitiveWordService.GetAllSensitiveWordTypes();
         ViewData["sensitiveWordTypes"] = sensitiveWordTypes;
         return View(model);
     }
     else
     {
         var sensitiveWord = sensitiveWordService.Get(id.Value);
         SensitiveWordEditModel model = sensitiveWord.AsEditModel();
         IEnumerable<SensitiveWordType> sensitiveWordTypes = sensitiveWordService.GetAllSensitiveWordTypes();
         ViewData["sensitiveWordTypes"] = sensitiveWordTypes;
         return View(model);
     }
 }