From 11414d95f6fe3a7e502e54280a08426f49196efc Mon Sep 17 00:00:00 2001 From: Hamid Reza Mohammadi Date: Thu, 19 Nov 2020 18:33:11 +0330 Subject: [PATCH] sorting recitation profiles by isdefault --- RMuseum/Services/Implementation/RecitationService.cs | 9 +++++++-- 1 file changed, 7 insertions(+), 2 deletions(-) diff --git a/RMuseum/Services/Implementation/RecitationService.cs b/RMuseum/Services/Implementation/RecitationService.cs index 4e4a75b5..7cc06e99 100644 --- a/RMuseum/Services/Implementation/RecitationService.cs +++ b/RMuseum/Services/Implementation/RecitationService.cs @@ -1120,8 +1120,13 @@ namespace RMuseum.Services.Implementation try { List profiles = new List(); - - foreach(UserRecitationProfile p in (await _context.UserRecitationProfiles.Include(p => p.User).Where(p => p.UserId == userId).ToArrayAsync())) + + foreach (UserRecitationProfile p in (await _context.UserRecitationProfiles.Include(p => p.User).Where(p => p.UserId == userId && p.IsDefault == true).ToArrayAsync())) + { + profiles.Add(new UserRecitationProfileViewModel(p)); + } + + foreach (UserRecitationProfile p in (await _context.UserRecitationProfiles.Include(p => p.User).Where(p => p.UserId == userId && p.IsDefault == false).ToArrayAsync())) { profiles.Add(new UserRecitationProfileViewModel(p)); }