diff --git a/RMuseum/Controllers/GanjoorController.cs b/RMuseum/Controllers/GanjoorController.cs index 456dda6d..43d56432 100644 --- a/RMuseum/Controllers/GanjoorController.cs +++ b/RMuseum/Controllers/GanjoorController.cs @@ -2435,6 +2435,32 @@ namespace RMuseum.Controllers } return Ok(res.Result != null); } + /// + /// switch bookmark and return bookmark id (0 for switching off a bookmark) + /// + /// + /// if you send a negative number it means you are trying to bookmark a comment + /// + [HttpPost] + [Route("bookmark/switch/ret/{poemId}/{coupletIndex}")] + [Authorize] + [ProducesResponseType((int)HttpStatusCode.OK, Type = typeof(bool))] + [ProducesResponseType((int)HttpStatusCode.BadRequest, Type = typeof(string))] + [ProducesResponseType((int)HttpStatusCode.NotFound)] + public async Task SwitchCoupletBookmarkReturnId(int poemId, int coupletIndex) + { + if (ReadOnlyMode) + return BadRequest("سایت به دلایل فنی مثل انتقال سرور موقتاً در حالت فقط خواندنی قرار دارد. لطفاً ساعاتی دیگر مجدداً تلاش کنید."); + Guid loggedOnUserId = new Guid(User.Claims.FirstOrDefault(c => c.Type == "UserId").Value); + RServiceResult res = await _ganjoorService.SwitchCoupletBookmark(loggedOnUserId, poemId, coupletIndex); + if (!string.IsNullOrEmpty(res.ExceptionString)) + { + if (res.ExceptionString == "verse not found") + return NotFound(); + return BadRequest(res.ExceptionString); + } + return Ok(res.Result == null ? 0 : res.Result.Id); + } /// /// Bookmark couplet if it is not diff --git a/RMuseum/RMuseum.xml b/RMuseum/RMuseum.xml index 7e8c3b1b..be536724 100644 --- a/RMuseum/RMuseum.xml +++ b/RMuseum/RMuseum.xml @@ -1579,6 +1579,14 @@ if you send a negative number it means you are trying to bookmark a comment + + + switch bookmark and return bookmark id (0 for switching off a bookmark) + + + if you send a negative number it means you are trying to bookmark a comment + + Bookmark couplet if it is not