using unused ids for new poets and more report from poet deletion

This commit is contained in:
Hamid Reza Mohammadi 2021-11-01 17:51:45 +03:30
parent eae09be110
commit 6b801efb6a
2 changed files with 13 additions and 3 deletions

View File

@ -8,8 +8,8 @@
},
"AllowedHosts": "*",
"GoogleAnalyticsCode": "",
"APIRoot": "https://ganjgah.ir",
"GlobalAPIRoot": "https://ganjgah.ir",
"APIRoot": "http://localhost:3439",
"GlobalAPIRoot": "http://localhost:3439",
"SiteUrl": "http://localhost:33081",
"ReadOnlyMode": "False"
}

View File

@ -3201,6 +3201,15 @@ namespace RMuseum.Services.Implementation
var id = 1 + await _context.GanjoorPoets.MaxAsync(p => p.Id);
for (int i = 2; i < id; i++)
{
if(!(await _context.GanjoorPoets.Where(p => p.Id == i).AnyAsync()))
{
id = i;
break;
}
}
if (string.IsNullOrEmpty(poet.Description))
poet.Description = "";
@ -3304,9 +3313,10 @@ namespace RMuseum.Services.Implementation
{
var pages = await context.GanjoorPages.Where(p => p.PoetId == id).ToListAsync();
context.GanjoorPages.RemoveRange(pages);
await jobProgressServiceEF.UpdateJob(job.Id, 50, "Deleting page and Querying the poet");
var poet = await context.GanjoorPoets.Where(p => p.Id == id).SingleAsync();
context.GanjoorPoets.Remove(poet);
await jobProgressServiceEF.UpdateJob(job.Id, 99);
await jobProgressServiceEF.UpdateJob(job.Id, 99, "Deleting poet");
await context.SaveChangesAsync();
await jobProgressServiceEF.UpdateJob(job.Id, 100, "", true);
}