Files
SteUP_Dotnet/SteUp.Shared/Core/Data/SteupDataService.cs

34 lines
1.2 KiB
C#

using IntegryApiClient.Core.Domain.Abstraction.Contracts.Account;
using SteUp.Shared.Core.Data.Contracts;
using SteUp.Shared.Core.Dto;
using SteUp.Shared.Core.Dto.PageState;
using SteUp.Shared.Core.Interface.IntegryApi;
using SteUp.Shared.Core.Interface.LocalDb;
namespace SteUp.Shared.Core.Data;
public class SteupDataService(
IIntegrySteupService integrySteupService,
IUserSession userSession,
IDbInitializer dbInitializer) : ISteupDataService
{
public async Task Init()
{
await dbInitializer.InitializeAsync();
await LoadDataAsync();
}
private async Task LoadDataAsync()
{
if (!await userSession.IsLoggedIn()) return;
PuntiVenditaList = await integrySteupService.RetrievePuntiVendita();
Reparti = await integrySteupService.RetrieveReparti();
TipiAttività = await integrySteupService.RetrieveActivityType();
}
public InspectionPageState InspectionPageState { get; set; } = new();
public List<PuntoVenditaDto> PuntiVenditaList { get; private set; } = [];
public List<JtbFasiDto> Reparti { get; private set; } = [];
public List<StbActivityTypeDto> TipiAttività { get; private set; } = [];
}