Fix init messageservice
This commit is contained in:
@@ -1,16 +1,21 @@
|
||||
using Blazored.LocalStorage;
|
||||
using Microsoft.AspNetCore.Components;
|
||||
using MP.Data.DTO;
|
||||
using NLog;
|
||||
using NLog.Fluent;
|
||||
|
||||
namespace MP.INVE.Data
|
||||
{
|
||||
public class MessageService
|
||||
{
|
||||
[Inject]
|
||||
protected ILocalStorageService localStorage { get; set; } = null!;
|
||||
[Inject]
|
||||
protected ILogger logger { get; set; } = null!;
|
||||
|
||||
public MessageService(ILocalStorageService genLocalStorage)
|
||||
{
|
||||
localStorage = genLocalStorage;
|
||||
}
|
||||
|
||||
private static Logger Log = LogManager.GetCurrentClassLogger();
|
||||
|
||||
/// <summary>
|
||||
/// Effettua pulizia localstorage
|
||||
@@ -30,20 +35,22 @@ namespace MP.INVE.Data
|
||||
}
|
||||
return answ;
|
||||
}
|
||||
|
||||
/// <summary>
|
||||
/// Restituisce il record OperatoreDTO da localstorage
|
||||
/// </summary>
|
||||
/// <returns></returns>
|
||||
public async Task<OperatoreDTO> getCurrOperDtoAsync()
|
||||
{
|
||||
OperatoreDTO answ = new OperatoreDTO();
|
||||
//var result = await localStorage.GetItemAsync<OperatoreDTO>("Opr");
|
||||
//if(result != null)
|
||||
//{
|
||||
// answ= result;
|
||||
//}
|
||||
OperatoreDTO answ = new OperatoreDTO();
|
||||
var result = await localStorage.GetItemAsync<OperatoreDTO>("Opr");
|
||||
if (result != null)
|
||||
{
|
||||
answ = result;
|
||||
}
|
||||
return answ;
|
||||
}
|
||||
|
||||
/// <summary>
|
||||
/// scrive il record OperatoreDTO nel localstorage
|
||||
/// </summary>
|
||||
@@ -55,6 +62,7 @@ namespace MP.INVE.Data
|
||||
answ = true;
|
||||
return answ;
|
||||
}
|
||||
|
||||
#if false
|
||||
|
||||
public event Action EA_PageUpdated = null!;
|
||||
@@ -196,7 +204,7 @@ namespace MP.INVE.Data
|
||||
private int _currPage { get; set; } = 1;
|
||||
|
||||
private int _numRecord { get; set; } = 10;
|
||||
private int _totalCount { get; set; } = 0;
|
||||
private int _totalCount { get; set; } = 0;
|
||||
#endif
|
||||
}
|
||||
}
|
||||
Reference in New Issue
Block a user