コード例 #1
0
        public async Task <IEnumerable <ReasonCodeDto> > HandleAsync(FindReasonCode query)
        {
            _registry.IncrementFindDiscountsQuery();

            var codes = await _reasonCodeRepository.FindAsync(
                c => c.AppointmentId == query.AppointmentIdId);

            return(codes.Select(rc => new ReasonCodeDto
            {
                Code = rc.Code,
                Description = rc.Description
            }));
        }
コード例 #2
0
        public async Task <IEnumerable <DiscountDto> > HandleAsync(IQuery query)
        {
            _registry.IncrementFindDiscountsQuery();
            var discounts = await _discountsRepository.FindAsync(c =>
                                                                 c.CustomerId == (query as FindDiscounts).CustomerId);

            return(discounts.Select(d => new DiscountDto
            {
                Id = d.Id,
                CustomerId = d.CustomerId,
                Code = d.Code,
                Percentage = d.Percentage,
                Available = !d.UsedAt.HasValue
            }));
        }