Book details changes liberated status in db and search engine. Minor changes to audible api to hopefully fix the weird log-in edge cases
This commit is contained in:
parent
35b5d7370c
commit
a639857ec6
@ -162,7 +162,7 @@ namespace ApplicationServices
|
|||||||
#endregion
|
#endregion
|
||||||
|
|
||||||
#region Update book details
|
#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
|
try
|
||||||
{
|
{
|
||||||
@ -170,16 +170,28 @@ namespace ApplicationServices
|
|||||||
|
|
||||||
var udi = book.UserDefinedItem;
|
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;
|
return 0;
|
||||||
|
|
||||||
// Attach() NoTracking entities before SaveChanges()
|
|
||||||
udi.Tags = newTags;
|
udi.Tags = newTags;
|
||||||
|
udi.BookStatus = bookStatus;
|
||||||
|
udi.PdfStatus = pdfStatus;
|
||||||
|
|
||||||
|
// Attach() NoTracking entities before SaveChanges()
|
||||||
context.Attach(udi).State = Microsoft.EntityFrameworkCore.EntityState.Modified;
|
context.Attach(udi).State = Microsoft.EntityFrameworkCore.EntityState.Modified;
|
||||||
var qtyChanges = context.SaveChanges();
|
var qtyChanges = context.SaveChanges();
|
||||||
|
|
||||||
if (qtyChanges > 0)
|
if (qtyChanges == 0)
|
||||||
|
return 0;
|
||||||
|
|
||||||
|
if (tagsChanged)
|
||||||
SearchEngineCommands.UpdateBookTags(book);
|
SearchEngineCommands.UpdateBookTags(book);
|
||||||
|
if (bookStatusChanged || pdfStatusChanged)
|
||||||
|
SearchEngineCommands.UpdateLiberatedStatus(book);
|
||||||
|
|
||||||
return qtyChanges;
|
return qtyChanges;
|
||||||
}
|
}
|
||||||
|
|||||||
@ -13,7 +13,7 @@
|
|||||||
<!-- <PublishSingleFile>true</PublishSingleFile> -->
|
<!-- <PublishSingleFile>true</PublishSingleFile> -->
|
||||||
<RuntimeIdentifier>win-x64</RuntimeIdentifier>
|
<RuntimeIdentifier>win-x64</RuntimeIdentifier>
|
||||||
|
|
||||||
<Version>5.5.1.3</Version>
|
<Version>5.5.1.5</Version>
|
||||||
</PropertyGroup>
|
</PropertyGroup>
|
||||||
|
|
||||||
<PropertyGroup Condition="'$(Configuration)|$(Platform)'=='Debug|AnyCPU'">
|
<PropertyGroup Condition="'$(Configuration)|$(Platform)'=='Debug|AnyCPU'">
|
||||||
|
|||||||
@ -95,7 +95,7 @@ namespace LibationWinForms
|
|||||||
if (bookDetailsForm.ShowDialog() != DialogResult.OK)
|
if (bookDetailsForm.ShowDialog() != DialogResult.OK)
|
||||||
return;
|
return;
|
||||||
|
|
||||||
var qtyChanges = LibraryCommands.UpdateTags(libraryBook.Book, bookDetailsForm.NewTags);
|
var qtyChanges = LibraryCommands.UpdateUserDefinedItem(libraryBook.Book, bookDetailsForm.NewTags, bookDetailsForm.BookLiberatedStatus, bookDetailsForm.PdfLiberatedStatus);
|
||||||
if (qtyChanges == 0)
|
if (qtyChanges == 0)
|
||||||
return;
|
return;
|
||||||
|
|
||||||
|
|||||||
Loading…
x
Reference in New Issue
Block a user