/// <summary> /// 修改服务 /// </summary> /// <param name="sqlconnect"></param> /// <returns></returns> public async Task <ActionResult> UpdateTemp(TemplateConfig temp) { PageResponse reponse = new PageResponse(); var update = _sqliteFreeSql.Update <TemplateConfig>(); var i = update.SetSource(temp).ExecuteAffrows(); _sqliteFreeSql.Dispose(); return(i > 0 ? Response(temp) : Response("添加失败")); }
/// <summary> /// 修改服务 /// </summary> /// <param name="sqlconnect"></param> /// <returns></returns> public ActionResult UpdateServer(SqlConnect sqlconnect) { PageResponse reponse = new PageResponse(); var update = _sqliteFreeSql.Update <SqlConnect>(); string strConn = ""; if (sqlconnect.SqlType == FreeSql.DataType.MySql) { strConn = $"server={sqlconnect.Host}:{sqlconnect.Port};uid={sqlconnect.Account};pwd={sqlconnect.Pwd};charset='utf8'"; } else { strConn = $"data source={sqlconnect.Host},{sqlconnect.Port};persist security info=True;user id={sqlconnect.Account};password={sqlconnect.Pwd};"; } sqlconnect.Address = strConn; var i = update.SetSource(sqlconnect).ExecuteAffrows(); _sqliteFreeSql.Dispose(); return(i > 0 ? Response(sqlconnect) : Response("修改失败")); }
/// <summary> /// 修改服务 /// </summary> /// <param name="sqlconnect"></param> /// <returns></returns> public async Task <JsonResult> UpdateServer(SqlConnect sqlconnect) { PageResponse reponse = new PageResponse(); var update = _sqliteFreeSql.Update <SqlConnect>(); var i = update.SetSource(sqlconnect).ExecuteAffrows(); _sqliteFreeSql.Dispose(); if (i > 0) { reponse.code = "200"; reponse.status = 0; reponse.msg = "修改成功!"; reponse.data = sqlconnect; } else { reponse.code = "500"; reponse.status = -1; reponse.msg = "修改失败!"; } return(Json(reponse)); }
/// <summary> /// 修改服务 /// </summary> /// <param name="sqlconnect"></param> /// <returns></returns> public JsonResult UpdateTemp(TemplateConfig temp) { PageResponse reponse = new PageResponse(); var update = _sqliteFreeSql.Update <TemplateConfig>(); var i = update.SetSource(temp).ExecuteAffrows(); _sqliteFreeSql.Dispose(); if (i > 0) { reponse.code = "200"; reponse.status = 0; reponse.msg = "修改成功!"; reponse.data = temp; } else { reponse.code = "500"; reponse.status = -1; reponse.msg = "修改失败!"; } return(Json(reponse)); }