public string SensitiveWordSave(MallSensitiveWord mallSensitiveWord) { string Keyword = mallSensitiveWord.Keyword; var oMallSensitiveWord = (from o in dbEntity.MallSensitiveWords where (o.OrgID == gOrgId && o.ChlID == gChlId) select o).ToList(); foreach (var item in oMallSensitiveWord) { if (item.Keyword == Keyword && item.Deleted == false) { return "ERROR"; } else if (item.Keyword == Keyword && item.Deleted == true) { item.Deleted = false; dbEntity.SaveChanges(); return "Success"; } } MallSensitiveWord oSensitiveWord = new MallSensitiveWord(); oSensitiveWord.OrgID = gOrgId; oSensitiveWord.ChlID = gChlId; oSensitiveWord.Keyword = oSensitiveWord.Keyword; oSensitiveWord.Remark = oSensitiveWord.Remark; dbEntity.MallSensitiveWords.Add(oSensitiveWord); dbEntity.SaveChanges(); return "Success"; }
public ActionResult SensitiveWordAddOrEdit(Guid? id) { MallSensitiveWord oMallSensitiveWord = new MallSensitiveWord(); //添加新的禁用IP if (id == null) { oMallSensitiveWord.OrgID = gOrgId; MemberOrganization oMemberOrganization = (from o in dbEntity.MemberOrganizations where (o.Gid == gOrgId && o.Deleted == false) select o).Single(); oMallSensitiveWord.Organization = oMemberOrganization; oMallSensitiveWord.ChlID = gChlId; MemberChannel oMemberChannel = (from o in dbEntity.MemberChannels where (o.Gid == gChlId && o.Deleted == false) select o).Single(); oMallSensitiveWord.Channel = oMemberChannel; List<SelectListItem> StatusList = GetSelectList(oMallSensitiveWord.GenericStatusList); } else { oMallSensitiveWord = (from o in dbEntity.MallSensitiveWords where (o.Gid == id && o.Deleted == false) select o).Single(); List<SelectListItem> StatusList = GetSelectList(oMallSensitiveWord.GenericStatusList); ViewBag.StatusList = StatusList; } return View("SensitiveWordAddOrEdit", oMallSensitiveWord); }