public JsonResult AddPromotionChannel() { if (string.IsNullOrWhiteSpace(Request.Form["name"])) { return(Json(new { rs = "error", msg = "参数错误" })); } string name = Request.Form["name"].Trim(); MarketOptionService service = new MarketOptionService(); SWfsSubjectPromotionChannel model = service.SelectPromotionChannel(name); if (model == null) { model = new SWfsSubjectPromotionChannel { ChannelName = name, CreateDateTime = DateTime.Now, CreateUserId = PresentationHelper.GetPassport().UserName }; try { int id = service.AddPromotionChannel(model); return(Json(new { rs = "ok", id = id, msg = "添加成功" })); } catch (Exception) { return(Json(new { rs = "error", msg = "添加失败" })); } } else { return(Json(new { rs = "error", msg = "添加成功" })); } }
public int AddPromotionChannel(SWfsSubjectPromotionChannel model) { return(DapperUtil.Insert <SWfsSubjectPromotionChannel>(model, true)); }