Exemple #1
0
        public async Task AddOrder(OrderModel orderModel)
        {
            Order order = orderModel.OrderMapToEntity();

            order.UserId = orderModel.UserId;
            var orderId = await _orderRespository.GetIdAfterCreate(order);

            foreach (OrderItemsModel orderItem in orderModel.OrderItemsModel)
            {
                PrintingEdition printingEdition = await _printingEditionRepository.Read(orderItem.PrintingEditionId);

                await _orderItemsRepository.Create(new OrderItems
                {
                    Amount            = orderItem.Amount,
                    Count             = orderItem.Count,
                    Currency          = orderItem.Currency,
                    OrderId           = orderId,
                    PrintingEditionId = orderItem.PrintingEditionId
                });
            }
            Payment payment = new Payment();

            payment.TransactionId = orderModel.StripeToken;
            payment.OrderId       = orderId;
            await _paymentRepository.GetIdAfterCreate(payment);
        }
Exemple #2
0
        public async Task <PrintingEditionModel> GetPrintingEditionModel(int id)
        {
            PrintingEditionModel printingEditionModel = new PrintingEditionModel(await _printingEditionRepository.Read(id));

            return(printingEditionModel);
        }