コード例 #1
0
ファイル: BillService.cs プロジェクト: mgce/Billy
        public async Task Add(AddBillDto dto)
        {
            var amount   = _amountFactory.Create(dto.AmountValue, dto.Currency);
            var supplier = await GetSupplierByName(dto.Supplier, dto.UserId);

            var category = await GetCategoryByName(dto.Category, dto.UserId);

            var bill = _billFactory.Create(dto.Name, amount, dto.PaymentDate.Date, supplier, category, dto.UserId);

            await _billRepository.Add(bill);
        }
コード例 #2
0
        private async Task Handle(CreateBillCommand command)
        {
            await HandleCommand(command, async x =>
            {
                var recipientAddress = new AddressValueObject(command.City, command.Street, command.Number);

                var bill = await _billFactory.Create(command.Id, command.Metadata.TenantId, command.Name, (BillType)command.Type, command.RecipientName, recipientAddress);

                await _billRepository.SaveAsync(bill);
            });
        }