TourIAm/TIAMWebApp/Client/Services/ServiceProviderDataServiceW...

119 lines
3.5 KiB
C#

using AyCode.Interfaces.StorageHandlers;
using Microsoft.AspNetCore.Authorization;
using Microsoft.AspNetCore.Components;
using Microsoft.JSInterop;
using System.Net.Http.Json;
using TIAM.Database.DataLayers.Users;
using TIAM.Entities.Products;
using TIAM.Entities.ServiceProviders;
using TIAM.Entities.Users;
using TIAMWebApp.Shared.Application.Interfaces;
using TIAMWebApp.Shared.Application.Models;
using TIAMWebApp.Shared.Application.Utility;
namespace TIAMWebApp.Client.Services
{
public class ServiceProviderDataServiceWeb : IServiceProviderDataService
{
private readonly HttpClient http;
private readonly ISecureStorageHandler secureStorageHandler;
private readonly IJSRuntime jsRuntime;
private readonly LogToBrowserConsole logToBrowserConsole;
public ServiceProviderDataServiceWeb(HttpClient http, ISecureStorageHandler secureStorageHandler, IJSRuntime jSRuntime)
{
this.http = http;
this.secureStorageHandler = secureStorageHandler;
this.jsRuntime = jSRuntime;
this.logToBrowserConsole = new LogToBrowserConsole(jsRuntime);
}
//22.
public Task<bool> CreateUserProductMappingAsync(UserProductMapping userProductMapping)
{
throw new NotImplementedException();
}
//19.
public Task<bool> CreateProductAsync(Product product)
{
throw new NotImplementedException();
}
//15.
public Task<bool> CreateServiceProviderAsync(TiamServiceProvider serviceProvider)
{
throw new NotImplementedException();
}
//21.
public Task DeleteProductAsync(Guid productId)
{
throw new NotImplementedException();
}
//13.
public Task DeleteServiceProviderAsync(Guid serviceProviderId)
{
throw new NotImplementedException();
}
//23.
public Task<List<UserProductMapping>> GetUserProductMappingsByProductIdAsync(Guid productId)
{
throw new NotImplementedException();
}
//17.
public async Task<Dictionary<Guid, string>?> GetPropertiesByOwnerIdAsync(Guid id)
{
var url = APIUrls.GetServiceProvidersByOwnerId;
var response = await http.PostAsJsonAsync(url, id);
if (response.IsSuccessStatusCode)
{
var result = await response.Content.ReadFromJsonAsync<Dictionary<Guid, string>>();
logToBrowserConsole.LogToBC(result.FirstOrDefault().Value);
return result;
}
else
{
return null;
}
}
//18.
public Task<TiamServiceProvider?> GetServiceProviderByIdAsync(Guid id)
{
throw new NotImplementedException();
}
//16.
public Task<List<TiamServiceProvider>> GetServiceProvidersAsync()
{
throw new NotImplementedException();
}
//24.
public Task RemoveUserProductMappingsByContextIdAsync(Guid productId)
{
throw new NotImplementedException();
}
//20.
public Task<bool> UpdateProductAsync(Product product)
{
throw new NotImplementedException();
}
//14.
public Task<bool> UpdateServiceProviderAsync(TiamServiceProvider serviceProvider)
{
throw new NotImplementedException();
}
}
}