From f105d110a7704dc130e4858ccc9eff3930b101e5 Mon Sep 17 00:00:00 2001 From: Hamid Reza Mohammadi Date: Mon, 30 Nov 2020 13:30:37 +0330 Subject: [PATCH] fix for def profile --- RMuseum/Services/Implementation/RecitationService.cs | 5 ++++- 1 file changed, 4 insertions(+), 1 deletion(-) diff --git a/RMuseum/Services/Implementation/RecitationService.cs b/RMuseum/Services/Implementation/RecitationService.cs index e7ea7bc4..6c23128a 100644 --- a/RMuseum/Services/Implementation/RecitationService.cs +++ b/RMuseum/Services/Implementation/RecitationService.cs @@ -1410,7 +1410,10 @@ namespace RMuseum.Services.Implementationa { try { - return new RServiceResult(new UserRecitationProfileViewModel(await _context.UserRecitationProfiles.Include(p => p.User).Where(p => p.UserId == userId && p.IsDefault == true).FirstOrDefaultAsync())); + var defProfile = await _context.UserRecitationProfiles.Include(p => p.User).Where(p => p.UserId == userId && p.IsDefault == true).FirstOrDefaultAsync(); + if (defProfile == null) + return new RServiceResult(null); + return new RServiceResult(new UserRecitationProfileViewModel(defProfile)); } catch (Exception exp) {