diff --git a/AsbCloudApp/Services/IFileService.cs b/AsbCloudApp/Services/IFileService.cs index fe96a6d6..7bf5f884 100644 --- a/AsbCloudApp/Services/IFileService.cs +++ b/AsbCloudApp/Services/IFileService.cs @@ -10,9 +10,8 @@ namespace AsbCloudApp.Services public interface IFileService { string RootPath { get; } - IDictionary SaveFileInfos(int idWell, - int idCategory, IEnumerable<(string fileName, int idWell, int idCategory, - DateTime date, int idUser)> filesInfo); + IDictionary SaveFileInfos(int idWell, int idUser, + IEnumerable filesInfo); Task SaveFile(int idWell, int idCategory, int fileId, string fileExtension, Stream fileStream); diff --git a/AsbCloudInfrastructure/Services/FileService.cs b/AsbCloudInfrastructure/Services/FileService.cs index d23b9fcb..ea34ea5e 100644 --- a/AsbCloudInfrastructure/Services/FileService.cs +++ b/AsbCloudInfrastructure/Services/FileService.cs @@ -23,8 +23,8 @@ namespace AsbCloudInfrastructure.Services this.db = db; } - public IDictionary SaveFileInfos(int idWell, int idCategory, - IEnumerable<(string fileName, int idWell, int idCategory, DateTime date, int idUser)> filesInfo) + public IDictionary SaveFileInfos(int idWell, int idUser, + IEnumerable filesInfo) { var fileIdsToNames = new Dictionary(); @@ -32,11 +32,11 @@ namespace AsbCloudInfrastructure.Services { var file = new AsbCloudDb.Model.FileInfo() { - Name = fileInfo.fileName, - IdWell = fileInfo.idWell, - IdCategory = fileInfo.idCategory, - UploadDate = fileInfo.date, - IdAuthor = fileInfo.idUser + Name = fileInfo.Name, + IdWell = idWell, + IdCategory = fileInfo.IdCategory, + UploadDate = fileInfo.UploadDate, + IdAuthor = idUser }; db.Files.Add(file); diff --git a/AsbCloudWebApi/Controllers/FileController.cs b/AsbCloudWebApi/Controllers/FileController.cs index 30b83a1c..1acb26ce 100644 --- a/AsbCloudWebApi/Controllers/FileController.cs +++ b/AsbCloudWebApi/Controllers/FileController.cs @@ -48,11 +48,15 @@ namespace AsbCloudWebApi.Controllers idWell, token).ConfigureAwait(false)) return Forbid(); - var fileInfoCollection = files.Select(f => - (f.FileName, idWell, idCategory, DateTime.Now, (int)idUser)); + var fileInfoCollection = files.Select(f => new FileInfoDto + { + Name = f.FileName, + IdCategory = idCategory, + UploadDate = DateTime.Now + }); - var fileNamesAndIds = fileService.SaveFileInfos(idWell, - idCategory, fileInfoCollection); + var fileNamesAndIds = fileService.SaveFileInfos(idWell, (int)idUser, + fileInfoCollection); foreach (var file in files)