diff --git a/server/AyaNova/Controllers/AttachmentController.cs b/server/AyaNova/Controllers/AttachmentController.cs index e73516e9..ad611b10 100644 --- a/server/AyaNova/Controllers/AttachmentController.cs +++ b/server/AyaNova/Controllers/AttachmentController.cs @@ -51,7 +51,7 @@ namespace AyaNova.Api.Controllers } - + //TODO: list with : name, notes, id, mimetype, lastmodified date /// @@ -85,6 +85,7 @@ namespace AyaNova.Api.Controllers string AttachToObjectType = string.Empty; string AttachToObjectId = string.Empty; string errorMessage = string.Empty; + string Notes = string.Empty; if (!uploadFormData.FormFieldData.ContainsKey("AttachToObjectType") || !uploadFormData.FormFieldData.ContainsKey("AttachToObjectId")) { @@ -95,6 +96,7 @@ namespace AyaNova.Api.Controllers { AttachToObjectType = uploadFormData.FormFieldData["AttachToObjectType"].ToString(); AttachToObjectId = uploadFormData.FormFieldData["AttachToObjectId"].ToString(); + Notes = uploadFormData.FormFieldData["Notes"].ToString(); if (string.IsNullOrWhiteSpace(AttachToObjectType) || string.IsNullOrWhiteSpace(AttachToObjectId)) { badRequest = true; @@ -165,7 +167,7 @@ namespace AyaNova.Api.Controllers { foreach (UploadedFileInfo a in uploadFormData.UploadedFiles) { - var v = await FileUtil.StoreFileAttachmentAsync(a.InitialUploadedPathName, a.MimeType, a.OriginalFileName, a.LastModified, attachToObject, ct); + var v = await FileUtil.StoreFileAttachmentAsync(a.InitialUploadedPathName, a.MimeType, a.OriginalFileName, a.LastModified, attachToObject, Notes, ct); returnList.Add(new NameIdItem() { Name = v.DisplayFileName, diff --git a/server/AyaNova/util/FileUtil.cs b/server/AyaNova/util/FileUtil.cs index de91b243..dbfa2f64 100644 --- a/server/AyaNova/util/FileUtil.cs +++ b/server/AyaNova/util/FileUtil.cs @@ -256,7 +256,7 @@ namespace AyaNova.Util /// /// internal static async Task StoreFileAttachmentAsync(string tempFilePath, string contentType, string fileName, DateTime lastModified, - AyaTypeId attachToObject, AyContext ct) + AyaTypeId attachToObject, string notes, AyContext ct) { //calculate hash var hash = FileHash.GetChecksum(tempFilePath); @@ -284,11 +284,12 @@ namespace AyaNova.Util { StoredFileName = hash, DisplayFileName = fileName, - Notes = string.Empty, + Notes = notes, ContentType = contentType, AttachToObjectId = attachToObject.ObjectId, AttachToObjectType = attachToObject.ObjectType, - LastModified=lastModified + LastModified = lastModified + }; //Store in DB