diff --git a/RMuseum/Controllers/GanjoorController.cs b/RMuseum/Controllers/GanjoorController.cs index 46103273..d66be5e8 100644 --- a/RMuseum/Controllers/GanjoorController.cs +++ b/RMuseum/Controllers/GanjoorController.cs @@ -2775,6 +2775,26 @@ namespace RMuseum.Controllers return Ok(res.Result); } + /// + /// get all poem sections + /// + /// + /// + [HttpGet] + [Route("sections/{poemId}")] + [AllowAnonymous] + [ProducesResponseType((int)HttpStatusCode.OK, Type = typeof(IEnumerable))] + [ProducesResponseType((int)HttpStatusCode.BadRequest, Type = typeof(string))] + [ProducesResponseType((int)HttpStatusCode.NotFound)] + public async Task GetPoemSectionsAsync(int poemId) + { + var res = + await _ganjoorService.GetPoemSectionsAsync(poemId); + if (!string.IsNullOrEmpty(res.ExceptionString)) + return BadRequest(res.ExceptionString); + return Ok(res.Result); + } + /// /// start band couplets fix /// diff --git a/RMuseum/Models/Ganjoor/ViewModels/GanjoorPoemSectionCorrectionViewModel.cs b/RMuseum/Models/Ganjoor/ViewModels/GanjoorPoemSectionCorrectionViewModel.cs index 568bf57c..e6684693 100644 --- a/RMuseum/Models/Ganjoor/ViewModels/GanjoorPoemSectionCorrectionViewModel.cs +++ b/RMuseum/Models/Ganjoor/ViewModels/GanjoorPoemSectionCorrectionViewModel.cs @@ -7,7 +7,7 @@ namespace RMuseum.Models.Ganjoor.ViewModels /// public class GanjoorPoemSectionCorrectionViewModel { - // + /// /// Correction Id /// public int Id { get; set; } diff --git a/RMuseum/RMuseum.xml b/RMuseum/RMuseum.xml index 8ba7b372..777f7880 100644 --- a/RMuseum/RMuseum.xml +++ b/RMuseum/RMuseum.xml @@ -1700,6 +1700,13 @@ + + + get all poem sections + + + + start band couplets fix @@ -12289,6 +12296,13 @@ + + + get all poem sections + + + + translation service implementation @@ -13920,6 +13934,13 @@ + + + get all poem sections + + + + start band couplets fix diff --git a/RMuseum/Services/IGanjoorService.cs b/RMuseum/Services/IGanjoorService.cs index 89514bc9..72651e2f 100644 --- a/RMuseum/Services/IGanjoorService.cs +++ b/RMuseum/Services/IGanjoorService.cs @@ -934,5 +934,12 @@ namespace RMuseum.Services /// /// Task> GetCoupletSectionsAsync(int poemId, int coupletIndex); + + /// + /// get all poem sections + /// + /// + /// + Task> GetPoemSectionsAsync(int id); } } diff --git a/RMuseum/Services/Implementation/GanjoorService-Partials/GanjoorService-PoemSections.cs b/RMuseum/Services/Implementation/GanjoorService-Partials/GanjoorService-PoemSections.cs index 0fc00a15..174ebb76 100644 --- a/RMuseum/Services/Implementation/GanjoorService-Partials/GanjoorService-PoemSections.cs +++ b/RMuseum/Services/Implementation/GanjoorService-Partials/GanjoorService-PoemSections.cs @@ -629,6 +629,19 @@ namespace RMuseum.Services.Implementation } } + /// + /// get all poem sections + /// + /// + /// + public async Task> GetPoemSectionsAsync(int id) + { + var sections = + await _context.GanjoorPoemSections.AsNoTracking().Include(s => s.GanjoorMetre).Where(s => s.PoemId == id).OrderBy(s => s.SectionType).ThenBy(s => s.VerseType).ToArrayAsync(); + + return new RServiceResult(sections); + } + /// /// start band couplets fix ///