geotag edit fix
This commit is contained in:
parent
aa84dca5be
commit
afa5b24ded
@ -363,7 +363,21 @@ namespace GanjooRazor.Areas.User.Pages
|
||||
$"{APIRoot.Url}/api/ganjoor/poem/correction/{poemid}");
|
||||
if (!response.IsSuccessStatusCode)
|
||||
{
|
||||
return BadRequest(JsonConvert.DeserializeObject<string>(await response.Content.ReadAsStringAsync()));
|
||||
string rawError = await response.Content.ReadAsStringAsync();
|
||||
string errorMessage;
|
||||
try
|
||||
{
|
||||
// normal case: API returns the error as a JSON-encoded string
|
||||
errorMessage = JsonConvert.DeserializeObject<string>(rawError);
|
||||
}
|
||||
catch (JsonException)
|
||||
{
|
||||
// API (or a proxy in front of it) returned something that isn't a
|
||||
// JSON string - e.g. an HTML error page - so don't let that throw
|
||||
// an unhandled exception here; fall back to a generic message.
|
||||
errorMessage = "خطایی در سرور رخ داد. لطفاً بعداً دوباره تلاش کنید.";
|
||||
}
|
||||
return BadRequest(errorMessage);
|
||||
}
|
||||
return new OkObjectResult(true);
|
||||
}
|
||||
|
||||
@ -2043,7 +2043,7 @@ namespace RMuseum.Services.Implementation
|
||||
/// <returns></returns>
|
||||
public async Task<RServiceResult<bool>> DeletePoemCorrections(Guid userId, int poemId)
|
||||
{
|
||||
var preCorrections = await _context.GanjoorPoemCorrections.Include(c => c.VerseOrderText)
|
||||
var preCorrections = await _context.GanjoorPoemCorrections.Include(c => c.VerseOrderText).Include(c => c.GeoDateTags)
|
||||
.Where(c => c.UserId == userId && c.PoemId == poemId && c.Reviewed == false)
|
||||
.ToListAsync();
|
||||
if (preCorrections.Count > 0)
|
||||
@ -2051,6 +2051,7 @@ namespace RMuseum.Services.Implementation
|
||||
foreach (var preCorrection in preCorrections)
|
||||
{
|
||||
preCorrection.VerseOrderText.Clear();
|
||||
preCorrection.GeoDateTags?.Clear();
|
||||
}
|
||||
_context.GanjoorPoemCorrections.RemoveRange(preCorrections);
|
||||
await _context.SaveChangesAsync();
|
||||
|
||||
Loading…
Reference in New Issue
Block a user