forked from ddrilling/AsbCloudServer
CS2-56: Changed tuple to FileInfoDto
This commit is contained in:
parent
8b5af8d32e
commit
d0deefe74f
@ -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);
|
||||
|
@ -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);
|
||||
|
@ -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)
|
||||
|
Loading…
Reference in New Issue
Block a user