Még nem tökéletes, EF javítása

This commit is contained in:
2025-03-03 16:56:11 +01:00
parent d4bad04103
commit 2ad8ba2d51
10 changed files with 857 additions and 73 deletions
@@ -1,4 +1,5 @@
using Microsoft.AspNetCore.Mvc;
using Serilog;
using WorkFlowCheck.BL.Services;
using WorkFlowCheck.BL.Services.Interfaces;
using WorkFlowCheck.Common.DTO;
@@ -16,43 +17,19 @@ namespace WorkFlowCheck.API.Controllers
}
[HttpGet("GetCheckListHeader/{id}")]
public async Task<ApiResponseDTO<CheckListHeaderDTO>> GetCheckListHeader()
public async Task<ApiResponseDTO<CheckListHeaderDTO>> GetCheckListHeader(int id)
{
var retVal = new ApiResponseDTO<List<CheckPointDTO>>()
var retVal = new ApiResponseDTO<CheckListHeaderDTO>()
{
IsSuccess = true,
};
var checkPointListDTO = await _checkListService.GetAllCheckPointAsync();
var checkListHeaderDTO = await _checkListService.GetCheckListHeader(id );
if (checkPointListDTO != null)
if (checkListHeaderDTO != null)
{
retVal.IsSuccess = true;
retVal.Data = checkPointListDTO;
}
else
{
retVal.IsSuccess = false;
retVal.Errors.Add("No data!");
}
return retVal;
}
[HttpGet("GetAllEquipments")]
public async Task<ApiResponseDTO<List<EquipmentDTO>>> GetAllEquipmentsAsync()
{
var retVal = new ApiResponseDTO<List<EquipmentDTO>>()
{
IsSuccess = true,
};
var equipmentListDTO = await _syncService.GetAllEquipmentAsync();
if (equipmentListDTO != null)
{
retVal.IsSuccess = true;
retVal.Data = equipmentListDTO;
retVal.Data = checkListHeaderDTO;
}
else
{
@@ -63,51 +40,23 @@ namespace WorkFlowCheck.API.Controllers
return retVal;
}
[HttpGet("GetAllLocations")]
public async Task<ApiResponseDTO<List<LocationDTO>>> GetAllLocationsAsync()
[HttpPost("StartNew")]
public async Task<ApiResponseDTO<CheckListHeaderDTO>> StartNew([FromBody] ApiRequestDTO<CheckListTemplateHeaderDTO> request)
{
var retVal = new ApiResponseDTO<List<LocationDTO>>()
var retVal = new ApiResponseDTO<CheckListHeaderDTO>()
{
IsSuccess = true,
IsSuccess = true
};
var locationListDTO = await _syncService.GetAllLocationAsync();
if (locationListDTO != null)
try
{
retVal.IsSuccess = true;
retVal.Data = locationListDTO;
var response = await _checkListService.StartNew(request);
}
else
catch (Exception ex)
{
retVal.IsSuccess = false;
retVal.Errors.Add("No data!");
Log.Error(ex.Message);
}
return retVal;
}
[HttpGet("GetAllCheckListTemplateHeader")]
public async Task<ApiResponseDTO<List<CheckListTemplateHeaderDTO>>> GetAllCheckListTemplateHeaderAsync()
{
var retVal = new ApiResponseDTO<List<CheckListTemplateHeaderDTO>>()
{
IsSuccess = true,
};
var response = await _syncService.GetAllCheckListTemplateAsync();
if (response != null)
{
retVal.IsSuccess = true;
retVal.Data = response;
}
else
{
retVal.IsSuccess = false;
retVal.Errors.Add("No data!");
}
return retVal;
}
}