Egy kis lapozás ...
This commit is contained in:
@@ -43,6 +43,29 @@ namespace WorkFlowCheck.API.Controllers
|
||||
|
||||
return retVal;
|
||||
}
|
||||
[HttpGet("DeleteCheckPoint/{id}")]
|
||||
public async Task<ApiResponseDTO<bool>> DeleteCheckpointAsync(int id)
|
||||
{
|
||||
var retVal = new ApiResponseDTO<bool>()
|
||||
{
|
||||
IsSuccess = true,
|
||||
};
|
||||
var response = await _syncService.DeleteCheckPointAsync(id);
|
||||
|
||||
if (response != null)
|
||||
{
|
||||
|
||||
retVal.IsSuccess = true;
|
||||
retVal.Data = response;
|
||||
}
|
||||
else
|
||||
{
|
||||
retVal.IsSuccess = false;
|
||||
retVal.Errors.Add("No data!");
|
||||
}
|
||||
|
||||
return retVal;
|
||||
}
|
||||
[HttpGet("GetAllCheckPoints")]
|
||||
public async Task<ApiResponseDTO<List<CheckPointDTO>>> GetAllCheckpointsAsync()
|
||||
{
|
||||
@@ -132,6 +155,29 @@ namespace WorkFlowCheck.API.Controllers
|
||||
|
||||
return retVal;
|
||||
}
|
||||
[HttpGet("DeleteEquipment/{id}")]
|
||||
public async Task<ApiResponseDTO<bool>> DeleteEquipmentAsync(int id)
|
||||
{
|
||||
var retVal = new ApiResponseDTO<bool>()
|
||||
{
|
||||
IsSuccess = true,
|
||||
};
|
||||
var response = await _syncService.DeleteEquipmentAsync(id);
|
||||
|
||||
if (response != null)
|
||||
{
|
||||
|
||||
retVal.IsSuccess = true;
|
||||
retVal.Data = response;
|
||||
}
|
||||
else
|
||||
{
|
||||
retVal.IsSuccess = false;
|
||||
retVal.Errors.Add("No data!");
|
||||
}
|
||||
|
||||
return retVal;
|
||||
}
|
||||
[HttpGet("GetAllEquipments")]
|
||||
public async Task<ApiResponseDTO<List<EquipmentDTO>>> GetAllEquipmentsAsync()
|
||||
{
|
||||
@@ -201,6 +247,29 @@ namespace WorkFlowCheck.API.Controllers
|
||||
|
||||
return retVal;
|
||||
}
|
||||
[HttpGet("DeleteLocation/{id}")]
|
||||
public async Task<ApiResponseDTO<bool>> DeleteLocationAsync(int id)
|
||||
{
|
||||
var retVal = new ApiResponseDTO<bool>()
|
||||
{
|
||||
IsSuccess = true,
|
||||
};
|
||||
var response = await _syncService.DeleteLocationAsync(id);
|
||||
|
||||
if (response != null)
|
||||
{
|
||||
|
||||
retVal.IsSuccess = true;
|
||||
retVal.Data = response;
|
||||
}
|
||||
else
|
||||
{
|
||||
retVal.IsSuccess = false;
|
||||
retVal.Errors.Add("No data!");
|
||||
}
|
||||
|
||||
return retVal;
|
||||
}
|
||||
[HttpGet("GetAllLocations")]
|
||||
public async Task<ApiResponseDTO<List<LocationDTO>>> GetAllLocationsAsync()
|
||||
{
|
||||
|
||||
@@ -74,7 +74,26 @@
|
||||
$('#tbLocationsPage').on('click', '.delete-btn', function ()
|
||||
{
|
||||
const row = table.row($(this).closest('tr')).data();
|
||||
console.log(row);
|
||||
|
||||
$.ajax({
|
||||
url: '/LocationsPage?handler=DeleteLocation', // A URL a handler-hez, ami az OnGetDeleteLocation metódust hívja
|
||||
type: 'GET', // A kérés típusa, ebben az esetben GET
|
||||
data: { id: 123 }, // Az id paraméter, amit átadsz
|
||||
success: function (data) {
|
||||
if (data.result) {
|
||||
// A válaszban lévő result true, tehát sikeres volt a törlés
|
||||
alert('Helyszín törölve!');
|
||||
} else {
|
||||
alert('Hiba történt a törlés során.');
|
||||
}
|
||||
},
|
||||
error: function (xhr, status, error) {
|
||||
// Ha valami hiba történik a kérés során
|
||||
alert('Hiba történt: ' + error);
|
||||
}
|
||||
});
|
||||
|
||||
|
||||
showConfirmModal({
|
||||
title: 'Törlés megerősítése',
|
||||
message: 'Biztosan törölni szeretnéd ezt az elemet?',
|
||||
|
||||
@@ -23,5 +23,10 @@ namespace WorkFlowCheck.Web.Pages.BaseStock.Locations
|
||||
var results = await _baseStockService.GetAllLocations();
|
||||
return new JsonResult(new { data = results });
|
||||
}
|
||||
public async Task<JsonResult> OnGetDeleteLocation(int id)
|
||||
{
|
||||
|
||||
return new JsonResult(new { result = true });
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user