diff --git a/GanjooRazor/Pages/_GroupedByDateViewPartial.cshtml b/GanjooRazor/Pages/_GroupedByDateViewPartial.cshtml index 84320b08..952557e8 100644 --- a/GanjooRazor/Pages/_GroupedByDateViewPartial.cshtml +++ b/GanjooRazor/Pages/_GroupedByDateViewPartial.cshtml @@ -65,8 +65,18 @@ break; case "poetspeclines": + +

+ کاربران گنجور می‌توانند برای چهره‌های شاعران گنجور نکاتی را پیشنهاد دهند. در صورت حذف حساب کاربری سوابق کلیهٔ نکات پیشنهادی به حساب سیستمی کاربر حذف شدهٔ گنجور منتقل می‌شود. +

+
break; case "poetpix": + +

+ کاربران گنجور می‌توانند برای چهره‌های شاعران گنجور تصاویری را پیشنهاد دهند. در صورت حذف حساب کاربری سوابق کلیهٔ تصاویر پیشنهادی به حساب سیستمی کاربر حذف شدهٔ گنجور منتقل می‌شود. +

+
break; case "usernotes": break; diff --git a/RMuseum/Services/Implementation/GanjoorAppUserService.cs b/RMuseum/Services/Implementation/GanjoorAppUserService.cs index 1decff5c..86454fad 100644 --- a/RMuseum/Services/Implementation/GanjoorAppUserService.cs +++ b/RMuseum/Services/Implementation/GanjoorAppUserService.cs @@ -7,6 +7,7 @@ using RMuseum.Models.Ganjoor; using RMuseum.Models.Ganjoor.ViewModels; using RMuseum.Models.GanjoorAudio; using RMuseum.Models.GanjoorAudio.ViewModels; +using RMuseum.Models.Note; using RSecurityBackend.Models.Auth.Db; using RSecurityBackend.Models.Auth.ViewModels; using RSecurityBackend.Models.Generic; @@ -451,6 +452,12 @@ namespace RMuseum.Services.Implementation await _DeleteComment(context, comment.Id); } + var userNotes = await context.UserNotes.Where(c => c.RAppUserId == userId).ToListAsync(); + foreach (var note in userNotes) + { + await _DeleteUserNotesAsync(context, note.Id); + } + var recitationsVotes = await context.RecitationUserUpVotes.Where(c => c.UserId == userId).ToListAsync(); foreach (var vote in recitationsVotes) { @@ -489,6 +496,32 @@ namespace RMuseum.Services.Implementation return await context.GanjoorComments.Where(c => c.InReplyToId == comment.Id).AsNoTracking().ToListAsync(); } + private async Task> _DeleteUserNotesAsync(RMuseumDbContext context, Guid commentId) + { + RUserNote comment = await context.UserNotes.Where(c => c.Id == commentId).SingleOrDefaultAsync(); + if (comment == null) + { + return new RServiceResult(false); //not found + } + + foreach (var reply in await _FindNoteRepliesAsync(context, comment)) + { + await _DeleteUserNotesAsync(context, reply.Id); + } + + + context.Remove(comment); + await _context.SaveChangesAsync(); + + return new RServiceResult(true); + } + + private async Task> _FindNoteRepliesAsync(RMuseumDbContext context, RUserNote comment) + { + return await context.UserNotes.Where(c => c.ReferenceNoteId == comment.Id).AsNoTracking().ToListAsync(); + } + + private async Task _ReOrderPoemRecitationsAsync(RMuseumDbContext context, int poemId, bool update = true) { var recitations =