public ActionResult AddMerchantInfo(AdminPanel.CodeModels.P_MerchantInfo cm) { CodeModels.CallBackEntity <string> cbe = new CallBackEntity <string>(); cm.Merchant_Code = Guid.NewGuid(); int rcount = SugarFactory.GetInstance().Insertable <P_MerchantInfo>(cm).ExecuteCommand(); if (rcount > 0) { cbe.Status = 200; cbe.Data = cm.Merchant_Code.ToString(); cbe.Msg = "成功"; } else { cbe.Status = 400; cbe.Msg = "失败"; } return(Json(cbe)); }
public ActionResult Save(FormCollection fc, AdminPanel.CodeModels.P_MerchantInfo cm) { int rcount = 0; if (Convert.ToInt32(fc["Id"]) > 0) { rcount = SugarFactory.GetInstance().Updateable <P_MerchantInfo>(cm).ExecuteCommand(); } else { rcount = SugarFactory.GetInstance().Insertable <P_MerchantInfo>(cm).ExecuteCommand(); } string formOperateType = fc["formOperateType"].ToString().ToLower(); if (formOperateType == "saveandnewnext") { if (rcount > 0) { return(Json(TipHelper.JsonData("新增商户信息成功", "", IsAlertTip.Yes, TipType.Success, AlertTipPageType.ThisPage, OperateTypeAfterTip.RefreshThisPage))); } else { return(Json(TipHelper.JsonData("新增商户信息失败!", "", IsAlertTip.Yes, TipType.Error, AlertTipPageType.ThisPage, OperateTypeAfterTip.NoAction))); } } else { if (rcount > 0) { return(Json(TipHelper.JsonData("保存商户信息成功!", "/MerchantInfo/MerchantInfoList", IsAlertTip.Yes, TipType.Success, AlertTipPageType.ThisPage, OperateTypeAfterTip.ThisPageGoAnotherPage))); } else { //表单提交失败固定写法 return(Json(TipHelper.JsonData("保存商户信息失败!", "", IsAlertTip.Yes, TipType.Error, AlertTipPageType.ThisPage, OperateTypeAfterTip.NoAction))); } } }