public void Update(EAuthor entity) { var collection = _database.GetCollection <EAuthor>(CollectionName); collection.ReplaceOneAsync(x => x.Id.Equals(entity.Id), entity, new UpdateOptions { IsUpsert = true }); }
EAuthor EAuthor(StoreContext context, string name) { var eAuthor = context.Authors.FirstOrDefault(a => a.Name == name); if (eAuthor != null) { return(eAuthor); } eAuthor = new EAuthor { Name = name }; return(eAuthor); }
public void Insert(EAuthor entity) { var collection = _database.GetCollection <EAuthor>(CollectionName); collection.InsertOne(entity); }