Web BaseStockService extend
This commit is contained in:
@@ -99,6 +99,49 @@ namespace WorkFlowCheck.Web.Services
|
|||||||
}
|
}
|
||||||
return retVal;
|
return retVal;
|
||||||
}
|
}
|
||||||
|
public async Task<EquipmentDTO> GetEquipment(int id)
|
||||||
|
{
|
||||||
|
string endpoint = $"{_httpClient.BaseAddress}api/Sync/GetEquipment/{id}";
|
||||||
|
var retVal = new EquipmentDTO();
|
||||||
|
try
|
||||||
|
{
|
||||||
|
var response = await _httpClient.GetFromJsonAsync<ApiResponseDTO<EquipmentDTO>>(endpoint);
|
||||||
|
if (response != null)
|
||||||
|
{
|
||||||
|
if (response.IsSuccess)
|
||||||
|
{
|
||||||
|
return response.Data;
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
|
catch (Exception ex)
|
||||||
|
{
|
||||||
|
Log.Error(ex.Message);
|
||||||
|
}
|
||||||
|
return retVal;
|
||||||
|
}
|
||||||
|
public async Task<LocationDTO> GetLocation(int id)
|
||||||
|
{
|
||||||
|
string endpoint = $"{_httpClient.BaseAddress}api/Sync/GetLocation/{id}";
|
||||||
|
var retVal = new LocationDTO();
|
||||||
|
try
|
||||||
|
{
|
||||||
|
var response = await _httpClient.GetFromJsonAsync<ApiResponseDTO<LocationDTO>>(endpoint);
|
||||||
|
if (response != null)
|
||||||
|
{
|
||||||
|
if (response.IsSuccess)
|
||||||
|
{
|
||||||
|
return response.Data;
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
|
catch (Exception ex)
|
||||||
|
{
|
||||||
|
Log.Error(ex.Message);
|
||||||
|
}
|
||||||
|
return retVal;
|
||||||
|
}
|
||||||
|
|
||||||
public async Task<CheckListTemplateRowDTO> GetCheckListTemplateRow(int id)
|
public async Task<CheckListTemplateRowDTO> GetCheckListTemplateRow(int id)
|
||||||
{
|
{
|
||||||
string endpoint = $"{_httpClient.BaseAddress}api/Sync/GetCheckListTemplateRow/{id}";
|
string endpoint = $"{_httpClient.BaseAddress}api/Sync/GetCheckListTemplateRow/{id}";
|
||||||
@@ -149,6 +192,62 @@ namespace WorkFlowCheck.Web.Services
|
|||||||
};
|
};
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
public async Task<ApiResponseDTO<EquipmentDTO>> UpdateEquipment(EquipmentDTO EquipmentDTO)
|
||||||
|
{
|
||||||
|
try
|
||||||
|
{
|
||||||
|
string endpoint = $"{_httpClient.BaseAddress}api/sync/updateEquipment";
|
||||||
|
|
||||||
|
using (HttpResponseMessage httpResponseMessage = await _httpClient.PostAsJsonAsync(endpoint, EquipmentDTO))
|
||||||
|
{
|
||||||
|
httpResponseMessage.EnsureSuccessStatusCode();
|
||||||
|
|
||||||
|
var jsonString = await httpResponseMessage.Content.ReadAsStringAsync();
|
||||||
|
var response = JsonConvert.DeserializeObject<ApiResponseDTO<EquipmentDTO>>(jsonString);
|
||||||
|
|
||||||
|
return response ?? new ApiResponseDTO<EquipmentDTO>
|
||||||
|
{
|
||||||
|
IsSuccess = false,
|
||||||
|
};
|
||||||
|
}
|
||||||
|
}
|
||||||
|
catch (Exception ex)
|
||||||
|
{
|
||||||
|
// Hiba visszaadása
|
||||||
|
return new ApiResponseDTO<EquipmentDTO>
|
||||||
|
{
|
||||||
|
IsSuccess = false
|
||||||
|
};
|
||||||
|
}
|
||||||
|
}
|
||||||
|
public async Task<ApiResponseDTO<LocationDTO>> UpdateLocation(LocationDTO LocationDTO)
|
||||||
|
{
|
||||||
|
try
|
||||||
|
{
|
||||||
|
string endpoint = $"{_httpClient.BaseAddress}api/sync/updateLocation";
|
||||||
|
|
||||||
|
using (HttpResponseMessage httpResponseMessage = await _httpClient.PostAsJsonAsync(endpoint, LocationDTO))
|
||||||
|
{
|
||||||
|
httpResponseMessage.EnsureSuccessStatusCode();
|
||||||
|
|
||||||
|
var jsonString = await httpResponseMessage.Content.ReadAsStringAsync();
|
||||||
|
var response = JsonConvert.DeserializeObject<ApiResponseDTO<LocationDTO>>(jsonString);
|
||||||
|
|
||||||
|
return response ?? new ApiResponseDTO<LocationDTO>
|
||||||
|
{
|
||||||
|
IsSuccess = false,
|
||||||
|
};
|
||||||
|
}
|
||||||
|
}
|
||||||
|
catch (Exception ex)
|
||||||
|
{
|
||||||
|
// Hiba visszaadása
|
||||||
|
return new ApiResponseDTO<LocationDTO>
|
||||||
|
{
|
||||||
|
IsSuccess = false
|
||||||
|
};
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|||||||
Reference in New Issue
Block a user