/// <summary> /// <inheritdoc /> /// </summary> public async Task <ImageUploadDbModel> Create(ImageUploadDbModel dbModel) { var collection = this.context.Database.GetCollection <ImageUploadDbModel>(); await collection.EnsureIndexAsync(x => x.UploadId); await collection.InsertAsync(dbModel); return(dbModel); }
/// <summary> /// <inheritdoc /> /// </summary> public async Task <ImageUploadDbModel> Create( StoragePathModel storagePath, List <ImageThumbnailResultModel> thumbnails, string ipAddress, int?lifetime) { DateTimeOffset?expirationDate = lifetime.HasValue ? DateTimeOffset.UtcNow.AddSeconds(lifetime.Value) : null; var dbModel = new ImageUploadDbModel { UploadId = storagePath.Key, OriginalFilePath = storagePath.FilePath, Thumbnails = thumbnails, IpAddress = ipAddress, ExpiresAt = expirationDate }; await this.Create(dbModel); return(dbModel); }