public async Task CreateAsync(ContentSchema schema) { if (schema.Id == Guid.Empty) { schema.Id = Guid.NewGuid(); } DateTime now = DateTimeService.Current(); schema.CreatedAt = now; schema.ModifiedAt = now; var mongo = schema.ToMongo(); await ContentSchemas.InsertOneAsync(mongo); schema.Id = mongo.Id; }
public async Task UpdateAsync(ContentSchema entity) { entity.ModifiedAt = DateTimeService.Current(); await ContentSchemas.FindOneAndReplaceAsync(Builders <MongoContentSchema> .Filter.Where(x => x.Id == entity.Id), entity.ToMongo()); }