get page url by id api
This commit is contained in:
parent
5a97115a89
commit
5b013c19b1
@ -154,6 +154,28 @@ namespace RMuseum.Controllers
|
||||
return Ok(res.Result);
|
||||
}
|
||||
|
||||
/// <summary>
|
||||
/// page url by id
|
||||
/// </summary>
|
||||
/// <param name="id"></param>
|
||||
/// <returns></returns>
|
||||
[HttpGet]
|
||||
[Route("pageurl")]
|
||||
[AllowAnonymous]
|
||||
[ProducesResponseType((int)HttpStatusCode.OK, Type = typeof(string))]
|
||||
[ProducesResponseType((int)HttpStatusCode.BadRequest, Type = typeof(string))]
|
||||
[ProducesResponseType((int)HttpStatusCode.NotFound)]
|
||||
public async Task<IActionResult> GetPageUrlById(int id)
|
||||
{
|
||||
RServiceResult<string> res =
|
||||
await _ganjoorService.GetPageUrlById(id);
|
||||
if (!string.IsNullOrEmpty(res.ExceptionString))
|
||||
return BadRequest(res.ExceptionString);
|
||||
if (string.IsNullOrEmpty(res.Result))
|
||||
return NotFound();
|
||||
return Ok(res.Result);
|
||||
}
|
||||
|
||||
/// <summary>
|
||||
/// get poem by id
|
||||
/// </summary>
|
||||
|
||||
@ -661,6 +661,13 @@
|
||||
<param name="catPoems"></param>
|
||||
<returns></returns>
|
||||
</member>
|
||||
<member name="M:RMuseum.Controllers.GanjoorController.GetPageUrlById(System.Int32)">
|
||||
<summary>
|
||||
page url by id
|
||||
</summary>
|
||||
<param name="id"></param>
|
||||
<returns></returns>
|
||||
</member>
|
||||
<member name="M:RMuseum.Controllers.GanjoorController.GetPoemById(System.Int32,System.Boolean,System.Boolean,System.Boolean,System.Boolean,System.Boolean,System.Boolean,System.Boolean,System.Boolean,System.Boolean)">
|
||||
<summary>
|
||||
get poem by id
|
||||
@ -5889,6 +5896,13 @@
|
||||
<param name="catPoems"></param>
|
||||
<returns></returns>
|
||||
</member>
|
||||
<member name="M:RMuseum.Services.IGanjoorService.GetPageUrlById(System.Int32)">
|
||||
<summary>
|
||||
get page url by id
|
||||
</summary>
|
||||
<param name="id"></param>
|
||||
<returns></returns>
|
||||
</member>
|
||||
<member name="M:RMuseum.Services.IGanjoorService.GetPoemById(System.Int32,System.Boolean,System.Boolean,System.Boolean,System.Boolean,System.Boolean,System.Boolean,System.Boolean,System.Boolean,System.Boolean)">
|
||||
<summary>
|
||||
Get Poem By Id
|
||||
@ -6763,6 +6777,13 @@
|
||||
<param name="poems"></param>
|
||||
<returns></returns>
|
||||
</member>
|
||||
<member name="M:RMuseum.Services.Implementation.GanjoorService.GetPageUrlById(System.Int32)">
|
||||
<summary>
|
||||
get page url by id
|
||||
</summary>
|
||||
<param name="id"></param>
|
||||
<returns></returns>
|
||||
</member>
|
||||
<member name="M:RMuseum.Services.Implementation.GanjoorService.GetPageByUrl(System.String,System.Boolean)">
|
||||
<summary>
|
||||
get page by url
|
||||
|
||||
@ -59,6 +59,13 @@ namespace RMuseum.Services
|
||||
/// <returns></returns>
|
||||
Task<RServiceResult<GanjoorPageCompleteViewModel>> GetPageByUrl(string url, bool catPoems = true);
|
||||
|
||||
/// <summary>
|
||||
/// get page url by id
|
||||
/// </summary>
|
||||
/// <param name="id"></param>
|
||||
/// <returns></returns>
|
||||
Task<RServiceResult<string>> GetPageUrlById(int id);
|
||||
|
||||
/// <summary>
|
||||
/// Get Poem By Id
|
||||
/// </summary>
|
||||
|
||||
@ -272,6 +272,26 @@ namespace RMuseum.Services.Implementation
|
||||
}
|
||||
}
|
||||
|
||||
/// <summary>
|
||||
/// get page url by id
|
||||
/// </summary>
|
||||
/// <param name="id"></param>
|
||||
/// <returns></returns>
|
||||
public async Task<RServiceResult<string>> GetPageUrlById(int id)
|
||||
{
|
||||
try
|
||||
{
|
||||
var dbPage = await _context.GanjoorPages.Where(p => p.Id == id).SingleOrDefaultAsync();
|
||||
if (dbPage == null)
|
||||
return new RServiceResult<string>(null); //not found
|
||||
return new RServiceResult<string>(dbPage.FullUrl);
|
||||
}
|
||||
catch(Exception exp)
|
||||
{
|
||||
return new RServiceResult<string>(null, exp.ToString());
|
||||
}
|
||||
}
|
||||
|
||||
/// <summary>
|
||||
/// get page by url
|
||||
/// </summary>
|
||||
|
||||
Loading…
Reference in New Issue
Block a user