public async Task <IDataResult <Evidence> > UpdateEvidenceAsync(UpdateEvidenceDTO updateEvidenceDTO) { var evidence = await _evidenceDal.GetEvidenceWithImageAsync(e => e.PublicId == updateEvidenceDTO.PublicId); var image = evidence.EvidenceImages.FirstOrDefault(eI => eI.EvidenceId == updateEvidenceDTO.Id).Image; var uploadResult = await _cloudinaryOperations.UpdateImageAsync(updateEvidenceDTO.ImageFile, evidence.PublicId); evidence.PublicId = uploadResult.PublicId; image.Url = uploadResult.Url.ToString(); evidence.Argument = updateEvidenceDTO.Argument; await _evidenceDal.UpdateEvidenceWithImageAsync(evidence, image); return(new SuccessfulDataResult <Evidence>(evidence, HttpStatusCode.OK)); }
public async Task <IActionResult> UpdateEvidence([FromForm] UpdateEvidenceDTO updateEvidenceDTO) { var result = await _evidenceService.UpdateEvidenceAsync(updateEvidenceDTO); return(StatusCode(result.HttpStatusCode, result.Data)); }