Aggiunta selezione negozio
This commit is contained in:
10
SteUp.Shared/Core/Data/Contracts/ISteupDataService.cs
Normal file
10
SteUp.Shared/Core/Data/Contracts/ISteupDataService.cs
Normal file
@@ -0,0 +1,10 @@
|
||||
using SteUp.Shared.Core.Dto;
|
||||
|
||||
namespace SteUp.Shared.Core.Data.Contracts;
|
||||
|
||||
public interface ISteupDataService
|
||||
{
|
||||
Task Init();
|
||||
|
||||
List<PuntoVenditaDto> PuntiVenditaList { get; }
|
||||
}
|
||||
25
SteUp.Shared/Core/Data/SteupDataService.cs
Normal file
25
SteUp.Shared/Core/Data/SteupDataService.cs
Normal file
@@ -0,0 +1,25 @@
|
||||
using IntegryApiClient.Core.Domain.Abstraction.Contracts.Account;
|
||||
using SteUp.Shared.Core.Data.Contracts;
|
||||
using SteUp.Shared.Core.Dto;
|
||||
using SteUp.Shared.Core.Interface.IntegryApi;
|
||||
|
||||
namespace SteUp.Shared.Core.Data;
|
||||
|
||||
public class SteupDataService(
|
||||
IIntegrySteupService integrySteupService,
|
||||
IUserSession userSession) : ISteupDataService
|
||||
{
|
||||
public Task Init()
|
||||
{
|
||||
return LoadDataAsync();
|
||||
}
|
||||
|
||||
private async Task LoadDataAsync()
|
||||
{
|
||||
if (!await userSession.IsLoggedIn()) return;
|
||||
|
||||
PuntiVenditaList = await integrySteupService.RetrievePuntiVendita();
|
||||
}
|
||||
|
||||
public List<PuntoVenditaDto> PuntiVenditaList { get; private set; } = [];
|
||||
}
|
||||
24
SteUp.Shared/Core/Dto/PuntoVenditaDto.cs
Normal file
24
SteUp.Shared/Core/Dto/PuntoVenditaDto.cs
Normal file
@@ -0,0 +1,24 @@
|
||||
using System.Text.Json.Serialization;
|
||||
|
||||
namespace SteUp.Shared.Core.Dto;
|
||||
|
||||
public class PuntoVenditaDto
|
||||
{
|
||||
[JsonPropertyName("codMdep")]
|
||||
public string? CodMdep { get; set; }
|
||||
|
||||
[JsonPropertyName("descrizione")]
|
||||
public string? Descrizione { get; set; }
|
||||
|
||||
[JsonPropertyName("indirizzo")]
|
||||
public string? Indirizzo { get; set; }
|
||||
|
||||
[JsonPropertyName("cap")]
|
||||
public string? Cap { get; set; }
|
||||
|
||||
[JsonPropertyName("citta")]
|
||||
public string? Citta { get; set; }
|
||||
|
||||
[JsonPropertyName("provincia")]
|
||||
public string? Provincia { get; set; }
|
||||
}
|
||||
24
SteUp.Shared/Core/Helpers/ModalHelper.cs
Normal file
24
SteUp.Shared/Core/Helpers/ModalHelper.cs
Normal file
@@ -0,0 +1,24 @@
|
||||
using MudBlazor;
|
||||
using SteUp.Shared.Components.SingleElements.Modal;
|
||||
|
||||
namespace SteUp.Shared.Core.Helpers;
|
||||
|
||||
public class ModalHelper
|
||||
{
|
||||
public static async Task<DialogResult?> OpenSelectShop(IDialogService dialog)
|
||||
{
|
||||
var modal = await dialog.ShowAsync<ModalSelectShop>(
|
||||
"ModalSelectShop",
|
||||
new DialogParameters(),
|
||||
new DialogOptions
|
||||
{
|
||||
FullScreen = false,
|
||||
CloseButton = false,
|
||||
NoHeader = true,
|
||||
BackdropClick = true
|
||||
}
|
||||
);
|
||||
|
||||
return await modal.Result;
|
||||
}
|
||||
}
|
||||
@@ -0,0 +1,9 @@
|
||||
using SteUp.Shared.Core.Dto;
|
||||
|
||||
namespace SteUp.Shared.Core.Interface.IntegryApi;
|
||||
|
||||
public interface IIntegrySteupService
|
||||
{
|
||||
//Retrieve
|
||||
Task<List<PuntoVenditaDto>> RetrievePuntiVendita();
|
||||
}
|
||||
17
SteUp.Shared/Core/Services/IntegrySteupService.cs
Normal file
17
SteUp.Shared/Core/Services/IntegrySteupService.cs
Normal file
@@ -0,0 +1,17 @@
|
||||
using IntegryApiClient.Core.Domain.RestClient.Contacts;
|
||||
using SteUp.Shared.Core.Dto;
|
||||
using SteUp.Shared.Core.Interface.IntegryApi;
|
||||
|
||||
namespace SteUp.Shared.Core.Services;
|
||||
|
||||
public class IntegrySteupService(IIntegryApiRestClient integryApiRestClient) : IIntegrySteupService
|
||||
{
|
||||
private const string BaseRequest = "steup";
|
||||
|
||||
#region Retrieve
|
||||
|
||||
public Task<List<PuntoVenditaDto>> RetrievePuntiVendita() =>
|
||||
integryApiRestClient.AuthorizedGet<List<PuntoVenditaDto>>($"{BaseRequest}/getPuntiVendita")!;
|
||||
|
||||
#endregion
|
||||
}
|
||||
Reference in New Issue
Block a user