GetDigitalSourceFromTagAsync
This commit is contained in:
parent
57fae5f53a
commit
54f7dfc1dc
@ -4223,6 +4223,27 @@ namespace RMuseum.Controllers
|
||||
return Ok();
|
||||
}
|
||||
|
||||
/// <summary>
|
||||
/// digital source from tag
|
||||
/// </summary>
|
||||
/// <param name="sourceUrlSlug"></param>
|
||||
/// <returns></returns>
|
||||
|
||||
[HttpGet]
|
||||
[Route("digitalsource")]
|
||||
[AllowAnonymous]
|
||||
[ProducesResponseType((int)HttpStatusCode.OK, Type = typeof(DigitalSource))]
|
||||
[ProducesResponseType((int)HttpStatusCode.BadRequest, Type = typeof(string))]
|
||||
public async Task<IActionResult> GetDigitalSourceFromTagAsync(string sourceUrlSlug)
|
||||
{
|
||||
RServiceResult<DigitalSource> res =
|
||||
await _ganjoorService.GetDigitalSourceFromTagAsync(sourceUrlSlug);
|
||||
if (!string.IsNullOrEmpty(res.ExceptionString))
|
||||
return BadRequest(res.ExceptionString);
|
||||
|
||||
return Ok(res.Result);//might be null
|
||||
}
|
||||
|
||||
/// <summary>
|
||||
/// tag category with source
|
||||
/// </summary>
|
||||
|
||||
@ -2288,6 +2288,13 @@
|
||||
<param name="model"></param>
|
||||
<returns></returns>
|
||||
</member>
|
||||
<member name="M:RMuseum.Controllers.GanjoorController.GetDigitalSourceFromTagAsync(System.String)">
|
||||
<summary>
|
||||
digital source from tag
|
||||
</summary>
|
||||
<param name="sourceUrlSlug"></param>
|
||||
<returns></returns>
|
||||
</member>
|
||||
<member name="M:RMuseum.Controllers.GanjoorController.TagCategoryWithSource(System.Int32,System.String)">
|
||||
<summary>
|
||||
tag category with source
|
||||
@ -17433,6 +17440,13 @@
|
||||
<param name="userId"></param>
|
||||
<returns></returns>
|
||||
</member>
|
||||
<member name="M:RMuseum.Services.IGanjoorService.GetDigitalSourceFromTagAsync(System.String)">
|
||||
<summary>
|
||||
digital source from tag
|
||||
</summary>
|
||||
<param name="sourceUrlSlug"></param>
|
||||
<returns></returns>
|
||||
</member>
|
||||
<member name="M:RMuseum.Services.IGanjoorService.TagCategoryWithSource(System.Int32,System.String)">
|
||||
<summary>
|
||||
tag with sources
|
||||
@ -19392,6 +19406,13 @@
|
||||
</summary>
|
||||
<returns></returns>
|
||||
</member>
|
||||
<member name="M:RMuseum.Services.Implementation.GanjoorService.GetDigitalSourceFromTagAsync(System.String)">
|
||||
<summary>
|
||||
get digital source from tag
|
||||
</summary>
|
||||
<param name="sourceUrlSlug"></param>
|
||||
<returns></returns>
|
||||
</member>
|
||||
<member name="M:RMuseum.Services.Implementation.GanjoorService.TagCategoryWithSource(System.Int32,System.String)">
|
||||
<summary>
|
||||
tag with sources
|
||||
|
||||
@ -1448,6 +1448,13 @@ namespace RMuseum.Services
|
||||
/// <returns></returns>
|
||||
Task<RServiceResult<bool>> ModerateGanjoorQuotedPoemAsync(GanjoorQuotedPoemModerationViewModel model, Guid userId);
|
||||
|
||||
/// <summary>
|
||||
/// digital source from tag
|
||||
/// </summary>
|
||||
/// <param name="sourceUrlSlug"></param>
|
||||
/// <returns></returns>
|
||||
Task<RServiceResult<DigitalSource>> GetDigitalSourceFromTagAsync(string sourceUrlSlug);
|
||||
|
||||
/// <summary>
|
||||
/// tag with sources
|
||||
/// </summary>
|
||||
|
||||
@ -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
|
||||
/// </summary>
|
||||
public partial class GanjoorService : IGanjoorService
|
||||
{
|
||||
/// <summary>
|
||||
/// get digital source from tag
|
||||
/// </summary>
|
||||
/// <param name="sourceUrlSlug"></param>
|
||||
/// <returns></returns>
|
||||
public async Task<RServiceResult<DigitalSource>> GetDigitalSourceFromTagAsync(string sourceUrlSlug)
|
||||
{
|
||||
try
|
||||
{
|
||||
return new RServiceResult<DigitalSource>(await _context.DigitalSources.AsNoTracking().Where(d => d.UrlSlug == sourceUrlSlug).SingleOrDefaultAsync());
|
||||
}
|
||||
catch (Exception exp)
|
||||
{
|
||||
return new RServiceResult<DigitalSource>(null, exp.ToString());
|
||||
}
|
||||
}
|
||||
/// <summary>
|
||||
/// tag with sources
|
||||
/// </summary>
|
||||
|
||||
Loading…
Reference in New Issue
Block a user