public ActionResult Edit(PointsRulesConfig model) { string js = "<script>alert(\"保存失败 \");location='/PointsRulesConfig/Index';</script>"; if (model.Id != 0) { if (PointsRulesConfigManager.UpdatePointsRulesConfig(model)) { return(RedirectToAction("Index")); } else { return(Content(js)); } } else { if (PointsRulesConfigManager.InsertPointsRulesConfig(model)) { return(RedirectToAction("Index")); } else { return(Content(js)); } } }
public static bool UpdatePointsRulesConfig(PointsRulesConfig model) { const string sql = @"UPDATE Configuration..PointsRulesConfig SET Content=@Content ,Status=@Status ,CreateTime=GETDATE() WHERE Id=@Id"; var sqlParameter = new SqlParameter[] { new SqlParameter("@Status", model.Status), new SqlParameter("@Content", model.Content ?? string.Empty), new SqlParameter("@Id", model.Id) }; return(SqlHelper.ExecuteNonQuery(conn, CommandType.Text, sql, sqlParameter) > 0); }
public bool InsertPointsRulesConfig(PointsRulesConfig model) { try { return(DALPointsRulesConfig.InsertPointsRulesConfig(model)); } catch (TuhuBizException) { throw; } catch (Exception ex) { var exception = new PointsRulesConfigException(1, "InsertPointsRulesConfig", ex); Logger.Log(Level.Error, exception, "InsertPointsRulesConfig"); throw ex; } }
public static bool InsertPointsRulesConfig(PointsRulesConfig model) { const string sql = @"INSERT INTO Configuration..PointsRulesConfig ( [Content] ,[Status] ,[CreateTime] ) VALUES( @Content ,@Status ,GETDATE() )"; var sqlParameter = new SqlParameter[] { new SqlParameter("@Status", model.Status), new SqlParameter("@Content", model.Content ?? string.Empty) }; return(SqlHelper.ExecuteNonQuery(conn, CommandType.Text, sql, sqlParameter) > 0); }