fix init vocabolario

This commit is contained in:
zaccaria.majid
2023-04-04 11:07:50 +02:00
parent b410d4dd0c
commit 6fa2b6eae2
6 changed files with 233 additions and 27 deletions
@@ -2,12 +2,9 @@
using Microsoft.EntityFrameworkCore;
using Microsoft.Extensions.Configuration;
using NLog;
using System.Collections.Generic;
using System.ComponentModel.Design;
using System.Data;
using WebDoorCreator.Data.DbModels;
using WebDoorCreator.Data.DTO;
using static WebDoorCreator.Core.Enum;
namespace WebDoorCreator.Data.Controllers
{
@@ -404,6 +401,7 @@ namespace WebDoorCreator.Data.Controllers
await Task.Delay(1);
return dbResult;
}
/// <summary>
/// Getting door data by orderId
/// </summary>
@@ -473,6 +471,30 @@ namespace WebDoorCreator.Data.Controllers
return fatto;
}
/// <summary>
/// Estraggo tutte le lingue disponibili per questa applicazione
/// </summary>
/// <returns></returns>
public List<LanguageModel> LanguageGetAll()
{
List<LanguageModel> dbResult = new List<LanguageModel>();
using (WDCDataContext localDbCtx = new WDCDataContext(_configuration))
{
try
{
// extracting entire set
dbResult = localDbCtx
.DbSetLanguages
.ToList();
}
catch (Exception exc)
{
Log.Error($"Error in LanguageGetAll:{Environment.NewLine}{exc}");
}
}
return dbResult;
}
/// <summary>
/// ListValues list (All)
/// </summary>
@@ -801,7 +823,6 @@ namespace WebDoorCreator.Data.Controllers
}
return dbResult;
}
public Dictionary<string, Dictionary<string, string>> VocLemmaGetAll()
{
Dictionary<string, Dictionary<string, string>> DTOResult = new Dictionary<string, Dictionary<string, string>>();
@@ -824,7 +845,7 @@ namespace WebDoorCreator.Data.Controllers
foreach (var lingua in lingue)
{
Dictionary<string, string> dict = new Dictionary<string, string>();
foreach (var lemma in allVoc.Where(x=>x.Lingua == lingua))
foreach (var lemma in allVoc.Where(x => x.Lingua == lingua))
{
dict.Add(lemma.Lemma, lemma.Traduzione);
}
@@ -880,6 +901,7 @@ namespace WebDoorCreator.Data.Controllers
}
return fatto;
}
#endregion Public Methods
#region Private Fields