public ActionResult Edit(ShareActivityRulesConfig model) { if (model.Id != 0) { return(Json(ShareActivityRulesConfigManager.UpdateShareActivityRules(model))); } else { return(Json(ShareActivityRulesConfigManager.InsertShareActivityRules(model))); } }
public bool InsertShareActivityRules(ShareActivityRulesConfig model) { try { return(DALShareActivityRules.InsertShareActivityRules(model)); } catch (TuhuBizException) { throw; } catch (Exception ex) { var exception = new ShareActivityRulesConfigException(1, "InsertShareActivityRules", ex); Logger.Log(Level.Error, exception, "InsertShareActivityRules"); throw ex; } }
public static bool UpdateShareActivityRules(ShareActivityRulesConfig model) { const string sql = @"UPDATE Configuration..ShareActivityRulesConfig SET Image= @Image ,Status=@Status ,Rules=@Rules ,CreateTime=GETDATE() WHERE Id=@Id"; var sqlParameter = new SqlParameter[] { new SqlParameter("@Status", model.Status), new SqlParameter("@Image", model.Image ?? string.Empty), new SqlParameter("@Rules", model.Rules ?? string.Empty), new SqlParameter("@Id", model.Id) }; return(SqlHelper.ExecuteNonQuery(conn, CommandType.Text, sql, sqlParameter) > 0); }
public static bool InsertShareActivityRules(ShareActivityRulesConfig model) { const string sql = @" INSERT INTO Configuration..ShareActivityRulesConfig ( [Image] ,[Status] ,[Rules] ,[CreateTime] ) VALUES( @Image ,@Status ,@Rules ,GETDATE() )"; var sqlParameter = new SqlParameter[] { new SqlParameter("@Status", model.Status), new SqlParameter("@Image", model.Image ?? string.Empty), new SqlParameter("@Rules", model.Rules ?? string.Empty) }; return(SqlHelper.ExecuteNonQuery(conn, CommandType.Text, sql, sqlParameter) > 0); }