public async Task <ActionResult> UpdateScoreRecordDetail(List <AuditRateDDto> listParms) { foreach (var item in listParms) { string folder = _webHostEnvironment.WebRootPath + "\\uploaded\\images"; if (item.Upload_Picture != null) { var source = item.Upload_Picture; string base64 = source.Substring(source.IndexOf(',') + 1); base64 = base64.Trim('\0'); byte[] chartData = Convert.FromBase64String(base64); if (!Directory.Exists(folder)) { Directory.CreateDirectory(folder); } var fileName = item.Record_ID + "_" + item.Audit_Item_ID + ".jpg"; string filePathB4 = Path.Combine(folder, fileName); System.IO.File.WriteAllBytes(filePathB4, chartData); item.Upload_Picture = fileName; } } if (await _auditRateService.UpdateListScopeRecordDetail(listParms, User.FindFirst(ClaimTypes.NameIdentifier).Value)) { return(NoContent()); } throw new Exception("Error Update"); }
public async Task <IActionResult> UpdateScoreRecordDetail(List <AuditRateDDto> listParams) { if (await _auditRateService.UpdateListScopeRecordDetail(listParams, User.FindFirst(ClaimTypes.NameIdentifier).Value)) { return(NoContent()); } throw new Exception("Error Update"); }