Пример #1
0
        public async Task <Guid> Handle(SavePaymentCommand request, CancellationToken cancellationToken)
        {
            var payment = _mapper.Map <Payment>(request.Payment);

            var guid = await _repository.CreatePayment(payment);

            await _repository.SaveAsync(cancellationToken);

            return(guid);
        }
Пример #2
0
        private async Task SaveDataToDB(XML.Orders item)
        {
            await _orderRepository.AddAsync(new DTO.Orders()
            {
                OxId          = item.Order.Oxid,
                OrderDatetime = item.Order.Orderdate
            });

            await _orderRepository.SaveAsync();

            await _billingAddressesRepository.AddAsync(new DTO.BillingAddresses()
            {
                Email      = item.Order.Billingaddress.Billemail,
                Fullname   = item.Order.Billingaddress.Billfname,
                Street     = item.Order.Billingaddress.Billstreet,
                City       = item.Order.Billingaddress.Billcity,
                Zip        = item.Order.Billingaddress.Billzip,
                HomeNumber = item.Order.Billingaddress.Billstreetnr,
                OrderOxId  = item.Order.Oxid,
                Country    = item.Order.Billingaddress.Country.Geo
            });

            await _billingAddressesRepository.SaveAsync();

            await _paymentsRepository.AddAsync(new Payments()
            {
                Amount     = item.Order.Payments.Payment.Amount,
                OrderOxId  = item.Order.Oxid,
                MethodName = item.Order.Payments.Payment.Methodname
            });

            await _paymentsRepository.SaveAsync();

            var orderArticle = item.Order.Articles.Orderarticle;

            orderArticle.Select(article =>
                                _articlesRepository.AddAsync(new DTO.Articles()
            {
                OrderOxId    = item.Order.Oxid,
                Amount       = article.Amount,
                BrutPrice    = article.Brutprice,
                Nomenclature = article.Artnum,
                Title        = article.Title
            }));

            await _articlesRepository.SaveAsync();
        }