diff --git a/RMuseum/Controllers/GanjoorController.cs b/RMuseum/Controllers/GanjoorController.cs
index 35ff02e6..7505b53a 100644
--- a/RMuseum/Controllers/GanjoorController.cs
+++ b/RMuseum/Controllers/GanjoorController.cs
@@ -4223,6 +4223,27 @@ namespace RMuseum.Controllers
return Ok();
}
+ ///
+ /// digital source from tag
+ ///
+ ///
+ ///
+
+ [HttpGet]
+ [Route("digitalsource")]
+ [AllowAnonymous]
+ [ProducesResponseType((int)HttpStatusCode.OK, Type = typeof(DigitalSource))]
+ [ProducesResponseType((int)HttpStatusCode.BadRequest, Type = typeof(string))]
+ public async Task GetDigitalSourceFromTagAsync(string sourceUrlSlug)
+ {
+ RServiceResult res =
+ await _ganjoorService.GetDigitalSourceFromTagAsync(sourceUrlSlug);
+ if (!string.IsNullOrEmpty(res.ExceptionString))
+ return BadRequest(res.ExceptionString);
+
+ return Ok(res.Result);//might be null
+ }
+
///
/// tag category with source
///
diff --git a/RMuseum/RMuseum.xml b/RMuseum/RMuseum.xml
index ba91c8f5..c95dc06e 100644
--- a/RMuseum/RMuseum.xml
+++ b/RMuseum/RMuseum.xml
@@ -2288,6 +2288,13 @@
+
+
+ digital source from tag
+
+
+
+
tag category with source
@@ -17433,6 +17440,13 @@
+
+
+ digital source from tag
+
+
+
+
tag with sources
@@ -19392,6 +19406,13 @@
+
+
+ get digital source from tag
+
+
+
+
tag with sources
diff --git a/RMuseum/Services/IGanjoorService.cs b/RMuseum/Services/IGanjoorService.cs
index 18fb7ae2..7ea86138 100644
--- a/RMuseum/Services/IGanjoorService.cs
+++ b/RMuseum/Services/IGanjoorService.cs
@@ -1448,6 +1448,13 @@ namespace RMuseum.Services
///
Task> ModerateGanjoorQuotedPoemAsync(GanjoorQuotedPoemModerationViewModel model, Guid userId);
+ ///
+ /// digital source from tag
+ ///
+ ///
+ ///
+ Task> GetDigitalSourceFromTagAsync(string sourceUrlSlug);
+
///
/// tag with sources
///
diff --git a/RMuseum/Services/Implementation/GanjoorService-Partials/GanjoorService-DigitalSources.cs b/RMuseum/Services/Implementation/GanjoorService-Partials/GanjoorService-DigitalSources.cs
index 3dce3424..0595c56d 100644
--- a/RMuseum/Services/Implementation/GanjoorService-Partials/GanjoorService-DigitalSources.cs
+++ b/RMuseum/Services/Implementation/GanjoorService-Partials/GanjoorService-DigitalSources.cs
@@ -6,9 +6,10 @@ using System.Linq;
using RMuseum.DbContext;
using System.Collections.Generic;
using RSecurityBackend.Services.Implementation;
-using NAudio.Gui;
using DNTPersianUtils.Core;
using System.Globalization;
+using System.Threading.Tasks;
+using RSecurityBackend.Models.Generic;
namespace RMuseum.Services.Implementation
{
@@ -17,6 +18,22 @@ namespace RMuseum.Services.Implementation
///
public partial class GanjoorService : IGanjoorService
{
+ ///
+ /// get digital source from tag
+ ///
+ ///
+ ///
+ public async Task> GetDigitalSourceFromTagAsync(string sourceUrlSlug)
+ {
+ try
+ {
+ return new RServiceResult(await _context.DigitalSources.AsNoTracking().Where(d => d.UrlSlug == sourceUrlSlug).SingleOrDefaultAsync());
+ }
+ catch (Exception exp)
+ {
+ return new RServiceResult(null, exp.ToString());
+ }
+ }
///
/// tag with sources
///