#427 edit approved mistakes for recitations (api)
This commit is contained in:
parent
10a25e1931
commit
f567133fc4
@ -936,6 +936,33 @@ namespace RMuseum.Controllers
|
||||
return Ok();
|
||||
}
|
||||
|
||||
/// <summary>
|
||||
/// edit approved mistake of a recitation text
|
||||
/// </summary>
|
||||
/// <param name="report"></param>
|
||||
/// <returns></returns>
|
||||
[HttpPut]
|
||||
[Route("errors/report/edit")]
|
||||
[Authorize(Policy = RMuseumSecurableItem.AudioRecitationEntityShortName + ":" + RMuseumSecurableItem.ModerateOperationShortName)]
|
||||
[ProducesResponseType((int)HttpStatusCode.OK, Type = typeof(int))]
|
||||
[ProducesResponseType((int)HttpStatusCode.BadRequest, Type = typeof(string))]
|
||||
[ProducesResponseType((int)HttpStatusCode.Forbidden)]
|
||||
public async Task<IActionResult> EditApprovedMistakeAsync([FromBody] RecitationErrorReportViewModel report)
|
||||
{
|
||||
if (ReadOnlyMode)
|
||||
return BadRequest("سایت به دلایل فنی مثل انتقال سرور موقتاً در حالت فقط خواندنی قرار دارد. لطفاً ساعاتی دیگر مجدداً تلاش کنید.");
|
||||
RServiceResult<bool> res = await _audioService.EditApprovedMistakeAsync(report.Id, report.ReasonText);
|
||||
if (!string.IsNullOrEmpty(res.ExceptionString))
|
||||
{
|
||||
return BadRequest(res.ExceptionString);
|
||||
}
|
||||
if (!res.Result)
|
||||
{
|
||||
return NotFound();
|
||||
}
|
||||
return Ok();
|
||||
}
|
||||
|
||||
/// <summary>
|
||||
/// remove approved mistake
|
||||
/// </summary>
|
||||
|
||||
@ -2742,6 +2742,13 @@
|
||||
<param name="report"></param>
|
||||
<returns></returns>
|
||||
</member>
|
||||
<member name="M:RMuseum.Controllers.RecitationController.EditApprovedMistakeAsync(RMuseum.Models.GanjoorAudio.ViewModels.RecitationErrorReportViewModel)">
|
||||
<summary>
|
||||
edit approved mistake of a recitation text
|
||||
</summary>
|
||||
<param name="report"></param>
|
||||
<returns></returns>
|
||||
</member>
|
||||
<member name="M:RMuseum.Controllers.RecitationController.RemoveApprovedMistakeAsync(System.Int32)">
|
||||
<summary>
|
||||
remove approved mistake
|
||||
@ -19926,6 +19933,14 @@
|
||||
<param name="id"></param>
|
||||
<returns></returns>
|
||||
</member>
|
||||
<member name="M:RMuseum.Services.Implementationa.RecitationService.EditApprovedMistakeAsync(System.Int32,System.String)">
|
||||
<summary>
|
||||
edit approved mistake text
|
||||
</summary>
|
||||
<param name="id"></param>
|
||||
<param name="reason"></param>
|
||||
<returns></returns>
|
||||
</member>
|
||||
<member name="M:RMuseum.Services.Implementationa.RecitationService.ComputePoemRecitationsOrdersAsync(System.Int32,System.Boolean)">
|
||||
<summary>
|
||||
compute poem recitations order
|
||||
@ -20474,6 +20489,14 @@
|
||||
<param name="id"></param>
|
||||
<returns></returns>
|
||||
</member>
|
||||
<member name="M:RMuseum.Services.IRecitationService.EditApprovedMistakeAsync(System.Int32,System.String)">
|
||||
<summary>
|
||||
edit approved mistake text
|
||||
</summary>
|
||||
<param name="id"></param>
|
||||
<param name="reason"></param>
|
||||
<returns></returns>
|
||||
</member>
|
||||
<member name="M:RMuseum.Services.IRecitationService.ComputePoemRecitationsOrdersAsync(System.Int32,System.Boolean)">
|
||||
<summary>
|
||||
compute poem recitations order
|
||||
|
||||
@ -256,6 +256,14 @@ namespace RMuseum.Services
|
||||
/// <returns></returns>
|
||||
Task<RServiceResult<bool>> RemoveApprovedMistakeAsync(int id);
|
||||
|
||||
/// <summary>
|
||||
/// edit approved mistake text
|
||||
/// </summary>
|
||||
/// <param name="id"></param>
|
||||
/// <param name="reason"></param>
|
||||
/// <returns></returns>
|
||||
Task<RServiceResult<bool>> EditApprovedMistakeAsync(int id, string reason);
|
||||
|
||||
/// <summary>
|
||||
/// compute poem recitations order
|
||||
/// </summary>
|
||||
|
||||
@ -2458,6 +2458,30 @@ namespace RMuseum.Services.Implementationa
|
||||
}
|
||||
}
|
||||
|
||||
/// <summary>
|
||||
/// edit approved mistake text
|
||||
/// </summary>
|
||||
/// <param name="id"></param>
|
||||
/// <param name="reason"></param>
|
||||
/// <returns></returns>
|
||||
public async Task<RServiceResult<bool>> EditApprovedMistakeAsync(int id, string reason)
|
||||
{
|
||||
try
|
||||
{
|
||||
var mistake = await _context.RecitationApprovedMistakes.Where(m => m.Id == id).SingleAsync();
|
||||
mistake.Mistake = reason;
|
||||
_context.Update(mistake);
|
||||
await _context.SaveChangesAsync();
|
||||
|
||||
return new RServiceResult<bool>(true);
|
||||
}
|
||||
catch (Exception exp)
|
||||
{
|
||||
|
||||
return new RServiceResult<bool>(false, exp.ToString());
|
||||
}
|
||||
}
|
||||
|
||||
/// <summary>
|
||||
/// compute poem recitations order
|
||||
/// </summary>
|
||||
|
||||
Loading…
Reference in New Issue
Block a user