#186 reload after correction postage

This commit is contained in:
Hamid Reza Mohammadi 2021-07-30 09:16:17 +04:30
parent ab3b7727c5
commit 5351fa0e4b
5 changed files with 5 additions and 16 deletions

View File

@ -155,13 +155,13 @@ namespace GanjooRazor.Areas.User.Pages
{
return new BadRequestObjectResult(await response.Content.ReadAsStringAsync());
}
return new OkObjectResult(true);
}
else
{
return new BadRequestObjectResult("لطفا از گنجور خارج و مجددا به آن وارد شوید.");
}
}
return new OkObjectResult(false);
}
}
}

View File

@ -236,7 +236,8 @@
},
success: function () {
alert('تصحیحات ارسال شد.')
alert('تصحیحات ارسال شد.');
location.reload(true);
},
error: function (e) {
alert(e)

View File

@ -70,7 +70,7 @@ namespace RMuseum.Models.Ganjoor
public RAppUser User { get; set; }
/// <summary>
/// reviewed
/// reviewed (this is now unnecessary due to Result field and can be removed)
/// </summary>
public bool Reviewed { get; set; }

View File

@ -4816,7 +4816,7 @@
</member>
<member name="P:RMuseum.Models.Ganjoor.GanjoorPoemCorrection.Reviewed">
<summary>
reviewed
reviewed (this is now unnecessary due to Result field and can be removed)
</summary>
</member>
<member name="P:RMuseum.Models.Ganjoor.GanjoorPoemCorrection.ReviewDate">

View File

@ -1305,12 +1305,6 @@ namespace RMuseum.Services.Implementation
/// <returns></returns>
public async Task<RServiceResult<GanjoorPoemCorrectionViewModel>> SuggestPoemCorrection(GanjoorPoemCorrectionViewModel correction)
{
//if the user has previously suggested corrections for this poem remove them and save this one as the last one
//assuming that his/her corrections are included in this correction
var existingsFromSameUser =
await _context.GanjoorPoemCorrections
.Where(c => c.PoemId == correction.PoemId && c.UserId == correction.UserId && c.Reviewed == false).ToArrayAsync();
var poem = (await GetPoemById(correction.PoemId, false, false, true, false, false, false, false, true, false)).Result;
foreach (var verse in correction.VerseOrderText)
{
@ -1333,12 +1327,6 @@ namespace RMuseum.Services.Implementation
await _context.SaveChangesAsync();
correction.Id = dbCorrection.Id;
if (existingsFromSameUser.Length > 0)
{
_context.GanjoorPoemCorrections.RemoveRange(existingsFromSameUser);
await _context.SaveChangesAsync();
}
return new RServiceResult<GanjoorPoemCorrectionViewModel>(correction);
}