Esempio n. 1
0
        public async Task <ApiListResponse <BeneficiaryDetailsModel> > GetBeneficiariesWithDetails(BeneficiariesListQuery query)
        {
            if (!this.IsTokenValid(_tokenService.GetTemporaryToken(this.GetCurrentUserId())))
            {
                throw new UnauthorizedAccessException();
            }

            var command = _mapper.Map <BeneficiariesDetailsListCommand>(query);

            command.UserId = UserId;

            var result = await _mediator.Send(command);

            return(result);
        }
Esempio n. 2
0
        public async Task <ApiListResponse <BeneficiarySummaryModel> > GetBeneficiaries(BeneficiariesListQuery query)
        {
            if (!this.IsTokenValid(_tokenService.GetTemporaryToken(this.GetCurrentUserId())))
            {
                throw new UnauthorizedAccessException();
            }

            var command = _mapper.Map <BeneficiariesListCommand>(query);

            if (query.UserId > 0)
            {
                command.UserId = query.UserId;
            }
            else
            {
                command.UserId     = UserId;
                command.AllFromNgo = true;
            }

            var result = await _mediator.Send(command);

            return(result);
        }