Ez is itt félig kész ...

This commit is contained in:
2025-03-03 13:24:57 +01:00
parent 499daa0e17
commit d4bad04103
7 changed files with 183 additions and 5 deletions
@@ -0,0 +1,114 @@
using Microsoft.AspNetCore.Mvc;
using WorkFlowCheck.BL.Services;
using WorkFlowCheck.BL.Services.Interfaces;
using WorkFlowCheck.Common.DTO;
namespace WorkFlowCheck.API.Controllers
{
[Route("api/[controller]")]
[ApiController]
public class CheckListController : ControllerBase
{
private ICheckListService _checkListService;
public CheckListController(ICheckListService checkListService)
{
_checkListService = checkListService;
}
[HttpGet("GetCheckListHeader/{id}")]
public async Task<ApiResponseDTO<CheckListHeaderDTO>> GetCheckListHeader()
{
var retVal = new ApiResponseDTO<List<CheckPointDTO>>()
{
IsSuccess = true,
};
var checkPointListDTO = await _checkListService.GetAllCheckPointAsync();
if (checkPointListDTO != 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;
}
else
{
retVal.IsSuccess = false;
retVal.Errors.Add("No data!");
}
return retVal;
}
[HttpGet("GetAllLocations")]
public async Task<ApiResponseDTO<List<LocationDTO>>> GetAllLocationsAsync()
{
var retVal = new ApiResponseDTO<List<LocationDTO>>()
{
IsSuccess = true,
};
var locationListDTO = await _syncService.GetAllLocationAsync();
if (locationListDTO != null)
{
retVal.IsSuccess = true;
retVal.Data = locationListDTO;
}
else
{
retVal.IsSuccess = false;
retVal.Errors.Add("No data!");
}
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;
}
}
}