ISyncService bővítése

This commit is contained in:
2025-02-27 12:47:58 +01:00
parent 5512120306
commit 883ae6b845
7 changed files with 130 additions and 36 deletions
@@ -23,6 +23,8 @@ namespace WorkFlowCheck.BL.Mappings
.ForMember(dest => dest.CheckListTemplateRowDTO, opt => opt.MapFrom(src => src.CheckListTemplateRows));
CreateMap<CheckListTemplateRow, CheckListTemplateRowDTO>();
CreateMap<CheckPoint, CheckPointDTO>();
CreateMap<Location, LocationDTO>();
CreateMap<Equipment, EquipmentDTO>();
}
}
}
@@ -5,7 +5,10 @@ namespace WorkFlowCheck.BL.Services.Interfaces
{
public interface ISyncService
{
Task<CheckPointListDTO> GetAllCheckPointAsync();
Task<List<CheckPointDTO>> GetAllCheckPointAsync();
Task<List<LocationDTO>> GetAllLocationAsync();
Task<List<EquipmentDTO>> GetAllEquipmentAsync();
Task<List<CheckListTemplateHeaderDTO>> GetAllCheckListTemplateAsync();
}
}
+43 -22
View File
@@ -2,6 +2,7 @@
using AutoMapper;
using Microsoft.EntityFrameworkCore;
using Serilog;
using System.Collections.Generic;
using WorkFlowCheck.BL.Services.Interfaces;
using WorkFlowCheck.Common.DTO;
using WorkFlowCheck.DL;
@@ -20,16 +21,54 @@ namespace WorkFlowCheck.BL.Services
_mapper = mapper;
}
public async Task<CheckPointListDTO> GetAllCheckPointAsync()
public async Task<List<CheckPointDTO>> GetAllCheckPointAsync()
{
var retVal = new CheckPointListDTO();
var retVal = new List<CheckPointDTO>();
try
{
var res = await _dbContext.CheckPoints.ToListAsync();
if (res != null)
{
retVal.CheckPointList = _mapper.Map<List<CheckPointDTO>>(res);
retVal = _mapper.Map<List<CheckPointDTO>>(res);
}
}
catch (Exception ex)
{
Log.Error(ex.Message);
}
return retVal;
}
public async Task<List<LocationDTO>> GetAllLocationAsync()
{
var retVal = new List<LocationDTO>();
try
{
var res = await _dbContext.Locations.ToListAsync();
if (res != null)
{
retVal = _mapper.Map<List<LocationDTO>>(res);
}
}
catch (Exception ex)
{
Log.Error(ex.Message);
}
return retVal;
}
public async Task<List<EquipmentDTO>> GetAllEquipmentAsync()
{
var retVal = new List<EquipmentDTO>();
try
{
var res = await _dbContext.Equipments.ToListAsync();
if (res != null)
{
retVal = _mapper.Map<List<EquipmentDTO>>(res);
}
}
catch (Exception ex)
@@ -60,24 +99,6 @@ namespace WorkFlowCheck.BL.Services
return retVal;
}
public async Task<CheckPointListDTO> GetAllLocation()
{
var retVal = new CheckPointListDTO();
try
{
var res = await _dbContext.CheckPoints.ToListAsync();
if (res != null)
{
retVal.CheckPointList = _mapper.Map<List<CheckPointDTO>>(res);
}
}
catch (Exception ex)
{
Log.Error(ex.Message);
}
return retVal;
}
}
}