public async Task <bool> Update(string name, CensoMapping item) { var prev = await Get(name); item.InternalId = prev.InternalId; item.Name = name; ReplaceOneResult actionResult = await context.CensoMappings.ReplaceOneAsync(n => n.Name.Equals(name), item, new UpdateOptions { IsUpsert = true }); return(actionResult.IsAcknowledged && actionResult.ModifiedCount > 0); }
public async Task Insert(CensoMapping item) { await context.CensoMappings.InsertOneAsync(item); }