public int PutPf(ProfileeModel list, bool zhuang, int uid, int tid) { try { zhuang = list.PfState; uid = list.UserId; tid = list.PfId; string msg = $"ProfileeController 进行了修改 数据为 list={JsonConvert.SerializeObject(list)},zhuan={zhuang},uid={uid},tid={tid}"; LogHelper.Logger.Info(msg); string sql = $"update Profilee set PfName='{list.PfName}',pfAddres='{list.PfAddres}',PfPhone='{list.PfPhone}',PfState={list.PfState} where 1=1 and UserId='{list.UserId}' and PfId='{list.PfId}' "; if (zhuang == true) { string sql1 = $"update Profilee set PfState = false WHERE PfId!={tid} and UserId = {uid} "; DBHelper.ExecuteNonQuery(sql1); } int n = DBHelper.ExecuteNonQuery(sql); return(n); } catch (Exception ex) { string msg = $"错误ProfileeController 进行了修改 数据为 list={JsonConvert.SerializeObject(list)},zhuan={zhuang},uid={uid},tid={tid}"; LogHelper.Logger.Error(msg, ex); throw; } }
public int PostPf([FromBody] ProfileeModel list, bool zhuang, int uid, int tid) { try { zhuang = list.PfState; uid = list.UserId; tid = list.PfId; string msg = $"ProfileeController 进行了添加 数据为 list={JsonConvert.SerializeObject(list)},zhuan={zhuang},uid={uid},tid={tid}"; LogHelper.Logger.Info(msg); string sql = $"insert into Profilee(PfName,pfAddres,PfPhone,PfState,UserId) values('{list.PfName}','{list.PfAddres}','{list.PfPhone}',{list.PfState},'{list.UserId}')"; if (zhuang == true) { string sql1 = $"update Profilee set PfState = false WHERE PfId!={tid} and UserId = {uid} "; DBHelper.ExecuteNonQuery(sql1); } int n = DBHelper.ExecuteNonQuery(sql); return(n); } catch (Exception ex) { string msg = $"ProfileeController 进行了添加 数据为 list={JsonConvert.SerializeObject(list)},zhuan={zhuang},uid={uid},tid={tid}"; LogHelper.Logger.Error(msg, ex); throw; } }