adding some views

This commit is contained in:
2026-03-22 16:28:01 +01:00
parent 498d46c10f
commit 7594d179a8
16 changed files with 327 additions and 92 deletions
@@ -1,37 +1,49 @@
using CityInfo.WEB.Models;
using System.Net.Http.Json;
namespace CityInfo.WEB.Services
{
public class PointOfInterestDataService : IPointOfInterestDataService
{
private readonly HttpClient _httpClient;
private readonly ILogger<PointOfInterestDataService> _logger;
public PointOfInterestDataService(
HttpClient httpClient)
HttpClient httpClient, ILogger<PointOfInterestDataService> logger)
{
_httpClient = httpClient;
_logger = logger;
}
public Task<PointOfInterest> CreatePointOfInterest(int cityId, PointOfInterest pointOfInterest)
public Task<PointOfInterest?> CreatePointOfInterest(int cityId, PointOfInterest pointOfInterest)
{
throw new NotImplementedException();
}
public Task DeletePointOfInterest(int cityId, int pointOfInterestId)
public Task<bool> DeletePointOfInterest(int cityId, int pointOfInterestId)
{
throw new NotImplementedException();
}
public Task<PointOfInterest> GetPointOfInterest(int cityId, int pointOfInterestId)
public Task<PointOfInterest?> GetPointOfInterest(int cityId, int pointOfInterestId)
{
throw new NotImplementedException();
}
public Task<IEnumerable<PointOfInterest>> GetPointsOfInterest(int cityId)
public async Task<IEnumerable<PointOfInterest>> GetPointsOfInterest(int cityId)
{
throw new NotImplementedException();
try
{
return await _httpClient.GetFromJsonAsync<IEnumerable<PointOfInterest>>($"api/cities/{cityId}/pointsofinterest/")
?? Enumerable.Empty<PointOfInterest>();
}
catch (Exception ex)
{
_logger.LogError(ex, "Erreur lors de la récupération des Points d'intérets.");
return Enumerable.Empty<PointOfInterest>();
}
}
public Task UpdatePointOfInterest(int cityId, PointOfInterest pointOfInterest)
public Task<bool> UpdatePointOfInterest(int cityId, PointOfInterest pointOfInterest)
{
throw new NotImplementedException();
}