public async Task <Result> UpdateImageAsync(ImageEntity imageEntity, CancellationToken cancellationToken = default(CancellationToken)) { var result = await _imageCollection.ReplaceOneAsync(t => t.ImageId == imageEntity.ImageId, imageEntity, new UpdateOptions { IsUpsert = false }, cancellationToken); if (result.MatchedCount == 0) { return(Result.Failed(new Error("Image not found", "Image not found"))); } return(Result.Success); }
public async Task <Result> CreateImageAsync(ImageEntity imageEntity, CancellationToken cancellationToken = default(CancellationToken)) { await _imageCollection.InsertOneAsync(imageEntity, null, cancellationToken); return(Result.Success); }