This commit is contained in:
@@ -51,7 +51,7 @@ namespace AyaNova.Api.Controllers
|
||||
}
|
||||
|
||||
|
||||
|
||||
//TODO: list with : name, notes, id, mimetype, lastmodified date
|
||||
|
||||
|
||||
/// <summary>
|
||||
@@ -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,
|
||||
|
||||
@@ -256,7 +256,7 @@ namespace AyaNova.Util
|
||||
/// </summary>
|
||||
/// <returns></returns>
|
||||
internal static async Task<FileAttachment> 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
|
||||
|
||||
Reference in New Issue
Block a user