using System; using System.Collections.Generic; using System.Linq; using System.Text; using System.Threading.Tasks; using Microsoft.Extensions.Options; using MongoDB.Driver; using UGQDatabase.Models; using UGQDataAccess.Settings; using ServerCommon.UGQ; namespace UGQDataAccess.Repository { public class NpcNameRepository : BaseRepository { private const string CollectionName = "NpcName"; public NpcNameRepository(IMongoClient mongoClient, IOptions settings) : base(mongoClient, settings.Value.DatabaseName, CollectionName) { } public async Task upsertNpcName(int npcId, TextEntity npcName) { var filter = Builders.Filter.Eq(x => x.NpcId, npcId); var update = Builders.Update .Set(x => x.NpcName, npcName); var option = new UpdateOptions { IsUpsert = true, }; await Collection.UpdateOneAsync(filter, update, option); } } }