Update to Async Attachement, Answer and Update Multiple Answers submission - backlog #288

This commit is contained in:
Reginald Cherenfant Jasmin
2023-08-27 11:55:58 -04:00
parent 5a641ff3aa
commit 96ccb96bf1
50 changed files with 166 additions and 1087 deletions

View File

@ -83,15 +83,15 @@ namespace DamageAssesment.Api.Attachments.Controllers
/// </summary>
[HttpPost("Attachments"), DisableRequestSizeLimit]
public IActionResult UploadAttachmentAsync(AttachmentInfo attachmentInfo)
public async Task<IActionResult> UploadAttachmentAsync(AttachmentInfo attachmentInfo)
{
try
{
if (attachmentInfo.Answers.Count > 0)
{
var Attachments = this.AttachmentProvider.GetAttachmentCounter();
var Attachments = await this.AttachmentProvider.GetAttachmentCounter();
List<Models.Attachment> attachments = UploadService.UploadAttachment(attachmentInfo.ResponseId, Attachments.counter, attachmentInfo.Answers);
var result = this.AttachmentProvider.PostAttachmentAsync(attachments);
var result = await this.AttachmentProvider.PostAttachmentAsync(attachments);
if (result.IsSuccess)
{
return Ok(result.Attachments);
@ -110,17 +110,17 @@ namespace DamageAssesment.Api.Attachments.Controllers
/// </summary>
[HttpPut("Attachments"), DisableRequestSizeLimit]
public IActionResult UpdateAttachmentAsync(AttachmentInfo attachmentInfo)
public async Task<IActionResult> UpdateAttachmentAsync(AttachmentInfo attachmentInfo)
{
try
{
if (attachmentInfo.Answers.Count > 0)
{
var res = this.AttachmentProvider.GetAttachmentInfo(attachmentInfo.Answers);
var res = await this.AttachmentProvider.GetAttachmentInfo(attachmentInfo.Answers);
if (res.IsSuccess)
{
List<Models.Attachment> attachments = UploadService.UpdateAttachments(attachmentInfo.ResponseId, attachmentInfo.Answers, res.Attachments);
var result = this.AttachmentProvider.PutAttachmentAsync(attachments);
var result = await this.AttachmentProvider.PutAttachmentAsync(attachments);
if (result.IsSuccess)
{
return Ok(result.Attachments);