diff --git a/RMuseum/Controllers/PDFLibraryController.cs b/RMuseum/Controllers/PDFLibraryController.cs
index 1c81a9b1..6740d3dc 100644
--- a/RMuseum/Controllers/PDFLibraryController.cs
+++ b/RMuseum/Controllers/PDFLibraryController.cs
@@ -927,6 +927,26 @@ namespace RMuseum.Controllers
return BadRequest(res.ExceptionString);
return Ok(res.Result);
}
+ ///
+ /// get volumes pdf books
+ ///
+ ///
+ ///
+ [HttpGet("volumes/{volumeId}/pdfs")]
+ [AllowAnonymous]
+ [ProducesResponseType((int)HttpStatusCode.OK, Type = typeof(IEnumerable))]
+ [ProducesResponseType((int)HttpStatusCode.BadRequest, Type = typeof(string))]
+
+ public async Task GetVolumesPDFBooks(int volumeId)
+ {
+ var res = await _pdfService.GetVolumesPDFBooks(volumeId);
+ if (!string.IsNullOrEmpty(res.ExceptionString))
+ {
+ return BadRequest(res.ExceptionString);
+ }
+
+ return Ok(res.Result);
+ }
///
/// PDF Service
diff --git a/RMuseum/RMuseum.xml b/RMuseum/RMuseum.xml
index 2c757c87..80f48f70 100644
--- a/RMuseum/RMuseum.xml
+++ b/RMuseum/RMuseum.xml
@@ -2588,6 +2588,13 @@
+
+
+ get volumes pdf books
+
+
+
+
PDF Service
@@ -17946,6 +17953,13 @@
+
+
+ get volumes pdf books
+
+
+
+
Database Context
@@ -18989,6 +19003,13 @@
+
+
+ get volumes pdf books
+
+
+
+
manipulating picture files
diff --git a/RMuseum/Services/IPDFLibraryService.cs b/RMuseum/Services/IPDFLibraryService.cs
index 9492dc91..182b43e2 100644
--- a/RMuseum/Services/IPDFLibraryService.cs
+++ b/RMuseum/Services/IPDFLibraryService.cs
@@ -254,5 +254,12 @@ namespace RMuseum.Services
///
///
Task> SetPDFBookCoverImageFromPageAsync(int pdfBookId, int pdfpageId);
+
+ ///
+ /// get volumes pdf books
+ ///
+ ///
+ ///
+ Task> GetVolumesPDFBooks(int volumeId);
}
}
diff --git a/RMuseum/Services/Implementation/PDFLibraryService.cs b/RMuseum/Services/Implementation/PDFLibraryService.cs
index c66478d2..f0887e1f 100644
--- a/RMuseum/Services/Implementation/PDFLibraryService.cs
+++ b/RMuseum/Services/Implementation/PDFLibraryService.cs
@@ -714,7 +714,7 @@ namespace RMuseum.Services.Implementation
{
role = role.Trim();
var pdfBook = await _context.PDFBooks.Include(b => b.Contributers).ThenInclude(a => a.Author).Where(b => b.Id == pdfBookId).SingleAsync();
- if(pdfBook.Contributers.Any(a => a.Author.Id == authorId && a.Role == role))
+ if (pdfBook.Contributers.Any(a => a.Author.Id == authorId && a.Role == role))
{
return new RServiceResult(false, "author contribution already added");
}
@@ -808,7 +808,7 @@ namespace RMuseum.Services.Implementation
{
foreach (var contributer in book.Contributers)
{
- if(contributer.Author.Id == authorId)
+ if (contributer.Author.Id == authorId)
{
if (roleCount.ContainsKey(contributer.Role))
{
@@ -823,7 +823,7 @@ namespace RMuseum.Services.Implementation
}
List authorRoles = new List();
- foreach(var role in roleCount.Keys)
+ foreach (var role in roleCount.Keys)
{
authorRoles.Add
(
@@ -834,7 +834,7 @@ namespace RMuseum.Services.Implementation
}
);
}
- return new RServiceResult(authorRoles.ToArray());
+ return new RServiceResult(authorRoles.ToArray());
}
catch (Exception exp)
{
@@ -871,7 +871,7 @@ namespace RMuseum.Services.Implementation
try
{
var dbBook = await _context.Books.Where(b => b.Id == model.Id).SingleAsync();
- dbBook.Name = model.Name;
+ dbBook.Name = model.Name;
dbBook.Description = model.Description;
dbBook.CoverImageId = model.CoverImageId;
dbBook.ExtenalCoverImageUrl = model.ExtenalCoverImageUrl;
@@ -1160,6 +1160,29 @@ namespace RMuseum.Services.Implementation
}
}
+ ///
+ /// get volumes pdf books
+ ///
+ ///
+ ///
+ public async Task> GetVolumesPDFBooks(int volumeId)
+ {
+ try
+ {
+ var books =
+ await _context.PDFBooks.AsNoTracking()
+ .Include(a => a.CoverImage)
+ .Where(a => a.Status == PublishStatus.Published && a.MultiVolumePDFCollectionId == volumeId)
+ .OrderBy(t => t.VolumeOrder)
+ .ToArrayAsync();
+ return new RServiceResult(books);
+ }
+ catch (Exception exp)
+ {
+ return new RServiceResult(null, exp.ToString());
+ }
+ }
+
///
/// Database Context
///