예제 #1
0
        public async Task <BillViewModel> Create(BillViewModel billVm)
        {
            try
            {
                var bill = new Bill(billVm.CustomerName, billVm.CustomerAddress, billVm.CustomerMobile, billVm.CustomerMessage, billVm.BillStatus,
                                    billVm.PaymentMethod, billVm.Status, billVm.CustomerId);
                bill.AddBillDetails(new BillDetailViewModel().Map(billVm.BillDetails).ToList());
                await _orderRepository.AddAsync(bill);

                _unitOfWork.Commit();
                return(new BillViewModel().Map(bill));
            }
            catch (Exception e)
            {
                Console.WriteLine(e);
                throw;
            }
        }