BaseService BL projektbe

This commit is contained in:
2025-04-03 12:06:40 +02:00
parent a97c944f12
commit d5e11bc2e4
5 changed files with 169 additions and 25 deletions
+17 -11
View File
@@ -12,16 +12,9 @@ using WorkFlowCheck.DL.Entities;
namespace WorkFlowCheck.BL.Services
{
public class SyncService : ISyncService
public class SyncService : BaseService, ISyncService
{
private AppDbContext _dbContext;
private IMapper _mapper;
public SyncService(AppDbContext dbContext, IMapper mapper)
{
_dbContext = dbContext;
_mapper = mapper;
}
public SyncService(AppDbContext dbContext, IMapper mapper) : base(dbContext, mapper) { }
public async Task<List<CheckPointDTO>> GetAllCheckPointAsync()
{
@@ -68,6 +61,10 @@ namespace WorkFlowCheck.BL.Services
return retVal;
}
public async Task<bool> DeleteCheckPointAsync(int id)
{
return await DeleteEntityByIdAsync<CheckPoint>(id);
}
public async Task<CheckPointDTO> UpdateCheckPointAsync(CheckPointDTO checkPointDTO)
{
var retVal = new CheckPointDTO();
@@ -173,6 +170,10 @@ namespace WorkFlowCheck.BL.Services
return retVal;
}
public async Task<bool> DeleteLocationAsync(int id)
{
return await DeleteEntityByIdAsync<Location>(id);
}
public async Task<LocationDTO> UpdateLocationAsync(LocationDTO LocationDTO)
{
var retVal = new LocationDTO();
@@ -249,6 +250,10 @@ namespace WorkFlowCheck.BL.Services
return retVal;
}
public async Task<bool> DeleteEquipmentAsync(int id)
{
return await DeleteEntityByIdAsync<Equipment>(id);
}
public async Task<EquipmentDTO> UpdateEquipmentAsync(EquipmentDTO EquipmentDTO)
{
var retVal = new EquipmentDTO();
@@ -284,6 +289,7 @@ namespace WorkFlowCheck.BL.Services
return retVal;
}
public async Task<List<CheckListTemplateHeaderDTO>> GetAllCheckListTemplateAsync(int userId)
{
var retVal = new List<CheckListTemplateHeaderDTO>();
@@ -377,12 +383,12 @@ namespace WorkFlowCheck.BL.Services
if (dtoRow != null)
{
row.Answer = dtoRow.Answer;
if (dtoRow.Photo != null && dtoRow.Photo.Length > 0 )
if (dtoRow.Photo != null && dtoRow.Photo.Length > 0)
{
string imageDirectory = Path.Combine(Directory.GetCurrentDirectory(), "Images");
var timestamp = DateTime.Now.ToString("yyyyMMdd_HHmmss");
var fileName = $"PH_{timestamp}_{row.CheckListHeaderId}_{row.Id}.jpeg";
row.PhotoFileName = fileName;
row.PhotoFileName = fileName;
var filePath = Path.Combine(imageDirectory, fileName);
await File.WriteAllBytesAsync(filePath, dtoRow.Photo);
}