put in new console why is not save attachment person id < 0

This commit is contained in:
2026-04-05 15:34:23 +10:00
parent 1681f48bbf
commit 7744dc3680
5 changed files with 9 additions and 10 deletions
-1
View File
@@ -1 +0,0 @@
,PC-KHAM/Kham,PC-KHAM,04.04.2026 22:40,file:///C:/Users/Kham/AppData/Roaming/LibreOffice/4;
@@ -72,6 +72,7 @@ namespace FamilyTreeAPI.Repository
}
_context.PersonPhotos.Add(model);
await _context.SaveChangesAsync();
result = model.Id;
statuscode = 1;
+2 -1
View File
@@ -3,7 +3,8 @@
"AppSettings": {
"Secret": "Nepean Blue Mountain Super Secret SIGN AND VERIFY JWT TOKENS, BEARER TOKEN USE WHEN CALLING THIS API.",
"SQLConnectionString0": "host=localhost;port=5432;database=FamilyTreeDB;username=postgres;password=Positive~1;",
"SQLConnectionString": "host=192.168.1.102;port=5432;database=FamilyTreeDB;username=postgres;password=Positive~1;",
"SQLConnectionString": "host=192.168.1.240;port=5432;database=FamilyTreeDB;username=postgres;password=Positive~1;",
"ImageFolder": "c:\\temp\\Family",
"ImportFolder": "c:\\temp"
+6 -8
View File
@@ -496,8 +496,9 @@ assignValue(item:Person): void {
this._id = item.id;
// this.messageService.add({severity:'success', summary: 'Save user', detail: item.firstName + " " + item.lastName });
//this.router.navigate([this.returnUrl]);
console.log("the person after save", item);
const list = this.getPhotoListforSave();
console.log("the person after save photo, person", list, item);
if (list.length > 0)
{
this.savePhotoList(list, item);
@@ -734,22 +735,19 @@ savePhotoList(list: PersonPhotoDto[], item:Person): void {
formData.append("files", file, file.name);
}
formData.append('personId', item.id.toString());
console.log("savephotolist person id", item.id, item);
const personPhoto$ = this.personService.savePersonPhotoList(formData);
this.subscription.add(personPhoto$.subscribe(
{
next: x => {
if (x.statusCode == 1) {
//const filename = x.data;
//this.adminuserForm.patchValue({ image: filename });
this.ref.close(item);
//this.cdr.detectChanges();
if (x.statusCode == 1) {
this.ref.close(item);
}
else
this.messageService.add({ severity: 'error', summary: 'Error save attach photos files', detail: 'Fail to photos file: ' + x.message });
},
error: e =>
this.messageService.add({ severity: 'error', summary: 'Error attach photos file', detail: 'Fail to photos file: ' })
this.messageService.add({ severity: 'error', summary: 'Error attach photos file', detail: 'Fail to photos file: ' })
}
));
Binary file not shown.