Ejemplo n.º 1
0
 public async Task <DataWithCount <IEnumerable <Mail> > > GetAllUnrepliedPaginatedAsync(int skip,
                                                                                        int take)
 {
     if (HasPermission(Permission.ReadAllMail))
     {
         int siteId = GetClaimId(ClaimType.SiteId);
         return(new DataWithCount <IEnumerable <Mail> >
         {
             Data = await _mailRepository.PageAdminUnrepliedAsync(siteId, skip, take),
             Count = await _mailRepository.GetAdminUnrepliedCountAsync(siteId)
         });
     }
     else
     {
         var userId = GetClaimId(ClaimType.UserId);
         _logger.LogError($"User {userId} doesn't have permission to get all unread mails.");
         throw new GraException("Permission denied.");
     }
 }