|
12345678910111213141516171819202122232425262728293031323334 |
- using MoYu.RemoteRequest.Extensions;
-
- namespace SafeCampus.Application.Services.Business.PersonFacesService;
-
- public class PersonFacesService:DbRepository<PersonFaces>, IPersonFacesService
- {
- public async Task<bool> BatchAdd(List<PersonFaces> list)
- {
- var oldList = await GetListAsync(x => x.PersonId == list[0].PersonId);
- await DeleteAsync(oldList);
- foreach (var item in list)
- {
- var signImg = Path.Combine(Directory.GetCurrentDirectory(), "Files", App.Configuration["AppInfo:PersonImg"], item.FaceId + ".jpg");
- await item.FaceUrl.GetToSaveAsync(signImg);
- item.FaceUrl = $"/Files/{App.Configuration["AppInfo:PersonImg"]}/{item.FaceId}.jpg";
- await InsertAsync(item);
- }
- //await InsertRangeAsync(list);
- return true;
- }
-
- public async Task<bool> Add(PersonFaces entity)
- {
- await InsertAsync(entity);
- return true;
- }
-
- public async Task<bool> Delete(string personId, List<string> faceIds)
- {
- var delList = await GetListAsync(x => x.PersonId == personId && faceIds.Contains(x.FaceId));
- await DeleteAsync(delList);
- return true;
- }
- }
|