diff --git a/ApplicationServices/LibraryCommands.cs b/ApplicationServices/LibraryCommands.cs
index c8f1a05f..b27d5693 100644
--- a/ApplicationServices/LibraryCommands.cs
+++ b/ApplicationServices/LibraryCommands.cs
@@ -162,7 +162,7 @@ namespace ApplicationServices
#endregion
#region Update book details
- public static int UpdateTags(Book book, string newTags)
+ public static int UpdateUserDefinedItem(Book book, string newTags, LiberatedStatus bookStatus, LiberatedStatus? pdfStatus)
{
try
{
@@ -170,16 +170,28 @@ namespace ApplicationServices
var udi = book.UserDefinedItem;
- if (udi.Tags == newTags)
+ var tagsChanged = udi.Tags != newTags;
+ var bookStatusChanged = udi.BookStatus != bookStatus;
+ var pdfStatusChanged = udi.PdfStatus != pdfStatus;
+
+ if (!tagsChanged && !bookStatusChanged && !pdfStatusChanged)
return 0;
- // Attach() NoTracking entities before SaveChanges()
udi.Tags = newTags;
+ udi.BookStatus = bookStatus;
+ udi.PdfStatus = pdfStatus;
+
+ // Attach() NoTracking entities before SaveChanges()
context.Attach(udi).State = Microsoft.EntityFrameworkCore.EntityState.Modified;
var qtyChanges = context.SaveChanges();
- if (qtyChanges > 0)
+ if (qtyChanges == 0)
+ return 0;
+
+ if (tagsChanged)
SearchEngineCommands.UpdateBookTags(book);
+ if (bookStatusChanged || pdfStatusChanged)
+ SearchEngineCommands.UpdateLiberatedStatus(book);
return qtyChanges;
}
diff --git a/LibationLauncher/LibationLauncher.csproj b/LibationLauncher/LibationLauncher.csproj
index adda89af..ee621d18 100644
--- a/LibationLauncher/LibationLauncher.csproj
+++ b/LibationLauncher/LibationLauncher.csproj
@@ -13,7 +13,7 @@
win-x64
- 5.5.1.3
+ 5.5.1.5
diff --git a/LibationWinForms/ProductsGrid.cs b/LibationWinForms/ProductsGrid.cs
index bed5c441..1aea5520 100644
--- a/LibationWinForms/ProductsGrid.cs
+++ b/LibationWinForms/ProductsGrid.cs
@@ -95,7 +95,7 @@ namespace LibationWinForms
if (bookDetailsForm.ShowDialog() != DialogResult.OK)
return;
- var qtyChanges = LibraryCommands.UpdateTags(libraryBook.Book, bookDetailsForm.NewTags);
+ var qtyChanges = LibraryCommands.UpdateUserDefinedItem(libraryBook.Book, bookDetailsForm.NewTags, bookDetailsForm.BookLiberatedStatus, bookDetailsForm.PdfLiberatedStatus);
if (qtyChanges == 0)
return;