#420 assigning user suggested photos to deleted users

This commit is contained in:
Hamid Reza Mohammadi 2024-01-30 11:14:43 +03:30
parent 22a7129894
commit d02c72754e

View File

@ -400,6 +400,11 @@ namespace RMuseum.Services.Implementation
context.UpdateRange(suggestedPoetPhotos);
await context.SaveChangesAsync();
var suggestQuotes = await context.GanjoorQuotedPoems.Where(s => s.SuggestedById == userId).ToListAsync();
foreach(var suggestedQuote in suggestedPoetPhotos)
suggestedQuote.SuggestedById = deletedUserId;
context.UpdateRange(suggestedPoetPhotos);
await context.SaveChangesAsync();
var visits = await context.GanjoorUserPoemVisits.Where(v => v.UserId == userId).ToListAsync();
context.RemoveRange(visits);