Equipment is kész.

This commit is contained in:
2025-03-20 13:12:05 +01:00
parent bd60138a89
commit ae7ba2342e
19 changed files with 639 additions and 79 deletions
@@ -16,6 +16,31 @@ namespace WorkFlowCheck.API.Controllers
_syncService = syncService;
}
[HttpGet("GetCheckPoint/{id}")]
public async Task<ApiResponseDTO<CheckPointDTO>> GetCheckpointAsync(int id)
{
var retVal = new ApiResponseDTO<CheckPointDTO>()
{
IsSuccess = true,
};
var checkPointListDTO = await _syncService.GetCheckPointAsync(id);
if (checkPointListDTO != null)
{
retVal.IsSuccess = true;
retVal.Data = checkPointListDTO;
}
else
{
retVal.IsSuccess = false;
retVal.Errors.Add("No data!");
}
return retVal;
}
[HttpGet("GetAllCheckPoints")]
public async Task<ApiResponseDTO<List<CheckPointDTO>>> GetAllCheckpointsAsync()
{
@@ -39,9 +64,31 @@ namespace WorkFlowCheck.API.Controllers
return retVal;
}
[HttpPost("UpdateCheckPoint")]
public async Task<ApiResponseDTO<CheckPointDTO>> UpdateCheckPoint([FromBody] CheckPointDTO checkPointDTO)
{
var retVal = new ApiResponseDTO<CheckPointDTO>()
{
IsSuccess = true
};
[HttpGet("GetCheckPoints/{id}")]
public async Task<ApiResponseDTO<CheckPointDTO>> GetCheckpointsAsync(int id)
try
{
var result = await _syncService.UpdateCheckPointAsync(checkPointDTO);
retVal.Data = result;
}
catch (Exception ex)
{
retVal.IsSuccess = false;
Log.Error(ex.Message);
}
return retVal;
}
[HttpGet("GetEquipment/{id}")]
public async Task<ApiResponseDTO<CheckPointDTO>> GetEquipmentAsync(int id)
{
var retVal = new ApiResponseDTO<CheckPointDTO>()
{
@@ -63,7 +110,6 @@ namespace WorkFlowCheck.API.Controllers
return retVal;
}
[HttpGet("GetAllEquipments")]
public async Task<ApiResponseDTO<List<EquipmentDTO>>> GetAllEquipmentsAsync()
{
@@ -87,7 +133,52 @@ namespace WorkFlowCheck.API.Controllers
return retVal;
}
[HttpPost("UpdateEquipment")]
public async Task<ApiResponseDTO<EquipmentDTO>> UpdateEquipment([FromBody] EquipmentDTO EquipmentDTO)
{
var retVal = new ApiResponseDTO<EquipmentDTO>()
{
IsSuccess = true
};
try
{
var result = await _syncService.UpdateEquipmentAsync(EquipmentDTO);
retVal.Data = result;
}
catch (Exception ex)
{
retVal.IsSuccess = false;
Log.Error(ex.Message);
}
return retVal;
}
[HttpGet("GetLocation/{id}")]
public async Task<ApiResponseDTO<CheckPointDTO>> GetLocationAsync(int id)
{
var retVal = new ApiResponseDTO<CheckPointDTO>()
{
IsSuccess = true,
};
var checkPointListDTO = await _syncService.GetCheckPointAsync(id);
if (checkPointListDTO != null)
{
retVal.IsSuccess = true;
retVal.Data = checkPointListDTO;
}
else
{
retVal.IsSuccess = false;
retVal.Errors.Add("No data!");
}
return retVal;
}
[HttpGet("GetAllLocations")]
public async Task<ApiResponseDTO<List<LocationDTO>>> GetAllLocationsAsync()
{
@@ -111,6 +202,28 @@ namespace WorkFlowCheck.API.Controllers
return retVal;
}
[HttpPost("UpdateLocation")]
public async Task<ApiResponseDTO<LocationDTO>> UpdateLocation([FromBody] LocationDTO LocationDTO)
{
var retVal = new ApiResponseDTO<LocationDTO>()
{
IsSuccess = true
};
try
{
var result = await _syncService.UpdateLocationAsync(LocationDTO);
retVal.Data = result;
}
catch (Exception ex)
{
retVal.IsSuccess = false;
Log.Error(ex.Message);
}
return retVal;
}
[HttpGet("GetAllCheckListTemplateHeader")]
public async Task<ApiResponseDTO<List<CheckListTemplateHeaderDTO>>> GetAllCheckListTemplateHeaderAsync()
@@ -136,26 +249,10 @@ namespace WorkFlowCheck.API.Controllers
return retVal;
}
[HttpPost("UpdateCheckPoint")]
public async Task<ApiResponseDTO<CheckPointDTO>> UpdateCheckPoint([FromBody] CheckPointDTO checkPointDTO)
{
var retVal = new ApiResponseDTO<CheckPointDTO>()
{
IsSuccess = true
};
try
{
var result = await _syncService.UpdateCheckPointAsync(checkPointDTO);
retVal.Data = result;
}
catch (Exception ex)
{
retVal.IsSuccess = false;
Log.Error(ex.Message);
}
return retVal;
}
}
}