working on edit form
This commit is contained in:
@@ -24,9 +24,32 @@ namespace CityInfo.WEB.Services
|
||||
throw new NotImplementedException();
|
||||
}
|
||||
|
||||
public Task<PointOfInterest?> GetPointOfInterest(int cityId, int pointOfInterestId)
|
||||
public async Task<PointOfInterest?> GetPointOfInterest(int cityId, int pointOfInterestId)
|
||||
{
|
||||
throw new NotImplementedException();
|
||||
try
|
||||
{
|
||||
var response = await _httpClient.GetAsync($"/api/cities/{cityId}/pointsofinterest/{pointOfInterestId}");
|
||||
|
||||
if (response.IsSuccessStatusCode)
|
||||
{
|
||||
return await response.Content.ReadFromJsonAsync<PointOfInterest>();
|
||||
}
|
||||
|
||||
if (response.StatusCode == System.Net.HttpStatusCode.NotFound)
|
||||
{
|
||||
return null;
|
||||
}
|
||||
|
||||
_logger.LogWarning($"Erreur HTTP {response.StatusCode} lors du chargement du point d'intéret {pointOfInterestId}",
|
||||
response.StatusCode, cityId);
|
||||
|
||||
return null;
|
||||
}
|
||||
catch (Exception ex)
|
||||
{
|
||||
_logger.LogError(ex, $"Erreur lors de la récupération du point d'intéret {pointOfInterestId}", cityId);
|
||||
return null;
|
||||
}
|
||||
}
|
||||
|
||||
public async Task<IEnumerable<PointOfInterest>> GetPointsOfInterest(int cityId)
|
||||
|
||||
Reference in New Issue
Block a user