CS2-56: Changed tuple to FileInfoDto

This commit is contained in:
KharchenkoVV 2021-08-19 17:32:22 +05:00
parent 8b5af8d32e
commit d0deefe74f
3 changed files with 17 additions and 14 deletions

View File

@ -10,9 +10,8 @@ namespace AsbCloudApp.Services
public interface IFileService
{
string RootPath { get; }
IDictionary<string, int> SaveFileInfos(int idWell,
int idCategory, IEnumerable<(string fileName, int idWell, int idCategory,
DateTime date, int idUser)> filesInfo);
IDictionary<string, int> SaveFileInfos(int idWell, int idUser,
IEnumerable<FileInfoDto> filesInfo);
Task SaveFile(int idWell, int idCategory, int fileId,
string fileExtension, Stream fileStream);

View File

@ -23,8 +23,8 @@ namespace AsbCloudInfrastructure.Services
this.db = db;
}
public IDictionary<string, int> SaveFileInfos(int idWell, int idCategory,
IEnumerable<(string fileName, int idWell, int idCategory, DateTime date, int idUser)> filesInfo)
public IDictionary<string, int> SaveFileInfos(int idWell, int idUser,
IEnumerable<FileInfoDto> filesInfo)
{
var fileIdsToNames = new Dictionary<string, int>();
@ -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);

View File

@ -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)