This commit is contained in:
@@ -51,7 +51,7 @@ namespace AyaNova.Api.Controllers
|
|||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
|
//TODO: list with : name, notes, id, mimetype, lastmodified date
|
||||||
|
|
||||||
|
|
||||||
/// <summary>
|
/// <summary>
|
||||||
@@ -85,6 +85,7 @@ namespace AyaNova.Api.Controllers
|
|||||||
string AttachToObjectType = string.Empty;
|
string AttachToObjectType = string.Empty;
|
||||||
string AttachToObjectId = string.Empty;
|
string AttachToObjectId = string.Empty;
|
||||||
string errorMessage = string.Empty;
|
string errorMessage = string.Empty;
|
||||||
|
string Notes = string.Empty;
|
||||||
|
|
||||||
if (!uploadFormData.FormFieldData.ContainsKey("AttachToObjectType") || !uploadFormData.FormFieldData.ContainsKey("AttachToObjectId"))
|
if (!uploadFormData.FormFieldData.ContainsKey("AttachToObjectType") || !uploadFormData.FormFieldData.ContainsKey("AttachToObjectId"))
|
||||||
{
|
{
|
||||||
@@ -95,6 +96,7 @@ namespace AyaNova.Api.Controllers
|
|||||||
{
|
{
|
||||||
AttachToObjectType = uploadFormData.FormFieldData["AttachToObjectType"].ToString();
|
AttachToObjectType = uploadFormData.FormFieldData["AttachToObjectType"].ToString();
|
||||||
AttachToObjectId = uploadFormData.FormFieldData["AttachToObjectId"].ToString();
|
AttachToObjectId = uploadFormData.FormFieldData["AttachToObjectId"].ToString();
|
||||||
|
Notes = uploadFormData.FormFieldData["Notes"].ToString();
|
||||||
if (string.IsNullOrWhiteSpace(AttachToObjectType) || string.IsNullOrWhiteSpace(AttachToObjectId))
|
if (string.IsNullOrWhiteSpace(AttachToObjectType) || string.IsNullOrWhiteSpace(AttachToObjectId))
|
||||||
{
|
{
|
||||||
badRequest = true;
|
badRequest = true;
|
||||||
@@ -165,7 +167,7 @@ namespace AyaNova.Api.Controllers
|
|||||||
{
|
{
|
||||||
foreach (UploadedFileInfo a in uploadFormData.UploadedFiles)
|
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()
|
returnList.Add(new NameIdItem()
|
||||||
{
|
{
|
||||||
Name = v.DisplayFileName,
|
Name = v.DisplayFileName,
|
||||||
|
|||||||
@@ -256,7 +256,7 @@ namespace AyaNova.Util
|
|||||||
/// </summary>
|
/// </summary>
|
||||||
/// <returns></returns>
|
/// <returns></returns>
|
||||||
internal static async Task<FileAttachment> StoreFileAttachmentAsync(string tempFilePath, string contentType, string fileName, DateTime lastModified,
|
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
|
//calculate hash
|
||||||
var hash = FileHash.GetChecksum(tempFilePath);
|
var hash = FileHash.GetChecksum(tempFilePath);
|
||||||
@@ -284,11 +284,12 @@ namespace AyaNova.Util
|
|||||||
{
|
{
|
||||||
StoredFileName = hash,
|
StoredFileName = hash,
|
||||||
DisplayFileName = fileName,
|
DisplayFileName = fileName,
|
||||||
Notes = string.Empty,
|
Notes = notes,
|
||||||
ContentType = contentType,
|
ContentType = contentType,
|
||||||
AttachToObjectId = attachToObject.ObjectId,
|
AttachToObjectId = attachToObject.ObjectId,
|
||||||
AttachToObjectType = attachToObject.ObjectType,
|
AttachToObjectType = attachToObject.ObjectType,
|
||||||
LastModified=lastModified
|
LastModified = lastModified
|
||||||
|
|
||||||
};
|
};
|
||||||
|
|
||||||
//Store in DB
|
//Store in DB
|
||||||
|
|||||||
Reference in New Issue
Block a user