fix for def profile

This commit is contained in:
Hamid Reza Mohammadi 2020-11-30 13:30:37 +03:30
parent c3ae0bd6c8
commit f105d110a7

View File

@ -1410,7 +1410,10 @@ namespace RMuseum.Services.Implementationa
{
try
{
return new RServiceResult<UserRecitationProfileViewModel>(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<UserRecitationProfileViewModel>(null);
return new RServiceResult<UserRecitationProfileViewModel>(new UserRecitationProfileViewModel(defProfile));
}
catch (Exception exp)
{