Пример #1
0
        public async Task <List <GetAllClaimsDto> > Handle(GetAllClaimsQuery request, CancellationToken cancellationToken)
        {
            List <Domain.Entities.Claim> claims = await _context.Claims.Where(c => !c.Deleted)
                                                  .ToListAsync();

            return(claims.Select(c => c.ToGetAllClaimsDto()).ToList());
        }
        public async Task <IEnumerable <ClaimDTO> > Handle(GetAllClaimsQuery command, CancellationToken cancellationToken)
        {
            var claims = await _claimRepository.GetAllAsync();

            return(claims.Select(claim => new ClaimDTO
            {
                ClaimId = claim.ClaimId,
                Date = claim.Date,
                UserId = claim.UserId,
                Description = claim.Description,
                Incidence = claim.Incidence,
                DamagedItem = claim.DamagedItem,
                Status = nameof(claim.Status),
                Street = claim.Street,
                City = claim.City,
                Country = claim.Country
            }));
        }
Пример #3
0
 public async Task <IList <Claim> > Handle(GetAllClaimsQuery request, CancellationToken cancellationToken)
 {
     return(await _repository.Claims.ToListAsync());
 }