check add person photo finish

This commit is contained in:
2025-10-27 16:23:06 +11:00
parent c62ae2cd42
commit cbb61b796f
28 changed files with 1084 additions and 86 deletions
@@ -20,12 +20,15 @@ public partial class PersonRepository : IPerson
private readonly FamilyTreeDBContext _context;
private readonly IRelationShipd _relationship;
private readonly IHttpContextAccessor _httpContext;
private readonly IPersonPhoto _personPhoto;
private readonly IConfiguration _config;
const string dateFormat = "yyyy-MM-dd";
public PersonRepository(IConfiguration config, FamilyTreeDBContext context,
IRelationShipd relationship,
IPersonPhoto personPhoto,
IHttpContextAccessor httpContext)
{
_personPhoto = personPhoto;
_context = context;
_relationship = relationship;
_config = config;
@@ -410,6 +413,8 @@ public partial class PersonRepository : IPerson
statuscode = 1;
ResultModel<List<RelationShipDto>> rlist = await _relationship.GetByPersonIdAsync(dto.Id);
dto.RelationShips = rlist.Data;
ResultModel<List<PersonPhotoDto>> personPhoto = await _personPhoto.LoadPersonPhoto(id);
dto.PersonPhotos = personPhoto.Data;
statuscode = rlist.StatusCode;
error = rlist.Message;
}
@@ -626,7 +631,7 @@ public partial class PersonRepository : IPerson
Directory.CreateDirectory(path);
}
extention = System.IO.Path.GetExtension(criteria.FileName);
filename = criteria.FamilyId + "_" + sdate + extention;
filename = criteria.PersonId + "_" + sdate + extention;
using (var fileStream = new FileStream(System.IO.Path.Combine(path, filename), FileMode.Create))
{
@@ -670,7 +675,7 @@ public partial class PersonRepository : IPerson
result = 1;
statusCode = 1;
Person? model = _context.Persons.Find(criteria.FamilyId);
Person? model = _context.Persons.Find(criteria.Id);
if (model != null)
{
model.Image = null;