/// <summary> /// 更新車隊互動資料 /// </summary> /// <param name="teamInteractiveData">teamInteractiveData</param> /// <returns>bool</returns> public async Task <bool> UpdateTeamInteractiveData(TeamInteractiveData teamInteractiveData) { try { FilterDefinition <TeamInteractiveData> filter = Builders <TeamInteractiveData> .Filter.Eq("_id", teamInteractiveData.Id); ReplaceOneResult result = await this.teamInteractiveDatas.ReplaceOneAsync(filter, teamInteractiveData); if (!result.IsAcknowledged) { this.logger.LogError($"Update Team Interactive Data Fail For IsAcknowledged >>> Data:{JsonConvert.SerializeObject(teamInteractiveData)}"); return(false); } if (result.ModifiedCount == 0) { this.logger.LogError($"Update Team Interactive Data Fail For ModifiedCount >>> Data:{JsonConvert.SerializeObject(teamInteractiveData)}"); return(false); } return(true); } catch (Exception ex) { this.logger.LogError($"Update Team Interactive Data Error >>> Data:{JsonConvert.SerializeObject(teamInteractiveData)}\n{ex}"); return(false); } }
/// <summary> /// 建立車隊互動資料 /// </summary> /// <param name="teamInteractiveData">teamInteractiveData</param> /// <returns>bool</returns> public async Task <bool> CreateTeamInteractiveData(TeamInteractiveData teamInteractiveData) { try { await this.teamInteractiveDatas.InsertOneAsync(teamInteractiveData); return(true); } catch (Exception ex) { this.logger.LogError($"Create Team Interactive Data Error >>> Data:{JsonConvert.SerializeObject(teamInteractiveData)}\n{ex}"); return(false); } }