1
0
mirror of https://github.com/RaidMax/IW4M-Admin.git synced 2025-06-10 15:20:48 -05:00

finish initial rework of profile page with meta pagination

This commit is contained in:
RaidMax
2019-03-29 21:56:56 -05:00
parent 25472b06c3
commit 807d9fa069
16 changed files with 227 additions and 140 deletions

View File

@ -159,6 +159,24 @@ namespace SharedLibraryCore.Services
}
}
public async Task<IList<EFPenalty>> GetAllClientPenaltiesAsync(int clientId, int count, int offset, DateTime? startAt)
{
using (var ctx = new DatabaseContext(true))
{
var iqPenalties = ctx.Penalties.AsNoTracking()
.Include(_penalty => _penalty.Offender.CurrentAlias)
.Include(_penalty => _penalty.Punisher.CurrentAlias)
.Where(_penalty => _penalty.Active)
.Where(_penalty => _penalty.OffenderId == clientId || _penalty.PunisherId == clientId)
.Where(_penalty => _penalty.When < startAt)
.OrderByDescending(_penalty => _penalty.When)
.Skip(offset)
.Take(count);
return await iqPenalties.ToListAsync();
}
}
/// <summary>
/// Get a read-only copy of client penalties
/// </summary>