forked from MDCPS/DamageAssessment_Backend
		
	doculink and attachments url changes
This commit is contained in:
		| @ -139,6 +139,30 @@ namespace DamageAssesment.Api.Attachments.Controllers | ||||
|             } | ||||
|         } | ||||
|         /// <summary> | ||||
|         /// download an existing attachment. | ||||
|         /// </summary> | ||||
|         [Authorize(Roles = "admin")] | ||||
|         [HttpGet("attachments/download/{id}")] | ||||
|         public async Task<IActionResult> downloadfile1(int id) | ||||
|         { | ||||
|             try | ||||
|             { | ||||
|                 var result = await this.AttachmentProvider.GetDownloadAttachmentAsync(id); | ||||
|                 if(!result.IsSuccess)  | ||||
|                     return NotFound(); | ||||
|                 byte[] fileContent = await UploadService.DownloadFile(result.Attachment.URI); | ||||
|                 if (fileContent == null || fileContent.Length == 0) | ||||
|                     return NotFound(); | ||||
|                 var contentType = "application/octet-stream"; | ||||
|                 return File(fileContent, contentType, result.Attachment.FileName); | ||||
|             } | ||||
|             catch (Exception ex) | ||||
|             { | ||||
|                 // Handle the exception here or log it | ||||
|                 return StatusCode(500, "An error occurred: " + ex.Message); | ||||
|             } | ||||
|         } | ||||
|         /// <summary> | ||||
|         /// Delete an existing attachment. | ||||
|         /// </summary> | ||||
|         [Authorize(Roles = "admin")] | ||||
|  | ||||
		Reference in New Issue
	
	Block a user