MP-PROG:
- correzione update tags da lettura dati
This commit is contained in:
@@ -153,6 +153,11 @@ namespace MP.FileData.Controllers
|
||||
}
|
||||
|
||||
Log.Info($"Effettuati {checkDone} controlli");
|
||||
// svuoto
|
||||
fileNew = new List<FileInfo>();
|
||||
fileChecked = new List<FileModel>();
|
||||
fileMod = new List<FileModel>();
|
||||
// chiudo
|
||||
return checkDone;
|
||||
}
|
||||
|
||||
@@ -267,6 +272,7 @@ namespace MP.FileData.Controllers
|
||||
dbResult = localDbCtx
|
||||
.DbSetProgFile
|
||||
.Where(x => x.Path.StartsWith(path) && ((onlyActive == x.Active) || !onlyActive))
|
||||
.Include(x => x.Tags)
|
||||
.OrderBy(x => x.Name)
|
||||
.ToList();
|
||||
}
|
||||
@@ -500,12 +506,21 @@ namespace MP.FileData.Controllers
|
||||
List<TagModel> currTags = localDbCtx.DbSetTags.ToList();
|
||||
foreach (var item in updFiles)
|
||||
{
|
||||
// recupero record da DB...
|
||||
var currItem = localDbCtx
|
||||
.DbSetProgFile
|
||||
.Where(x => x.FileId == item.FileId)
|
||||
.Include(x => x.Tags)
|
||||
.FirstOrDefault();
|
||||
#if false
|
||||
// rimuovo tags vecchi
|
||||
if (item.Tags != null)
|
||||
if (currItem.Tags != null)
|
||||
{
|
||||
item.Tags.Clear();
|
||||
localDbCtx.SaveChanges();
|
||||
}
|
||||
currItem.Tags.Clear();
|
||||
//localDbCtx.Entry(item).State = EntityState.Modified;
|
||||
//localDbCtx.SaveChanges();
|
||||
}
|
||||
#endif
|
||||
|
||||
List<string> Tags = new List<string>();
|
||||
List<TagModel> Tag4File = new List<TagModel>();
|
||||
@@ -552,8 +567,11 @@ namespace MP.FileData.Controllers
|
||||
if (Tag4File.Count > 0)
|
||||
{
|
||||
// salvo i tags relativi ai files
|
||||
item.Tags = Tag4File;
|
||||
currItem.Tags.Clear();
|
||||
currItem.Tags = Tag4File;
|
||||
//localDbCtx.Entry(currItem).State = EntityState.Modified;
|
||||
}
|
||||
//localDbCtx.SaveChanges();
|
||||
}
|
||||
try
|
||||
{
|
||||
|
||||
Reference in New Issue
Block a user