Beispiel #1
0
        public CustomerPaymentDTO GetCustomerPaymentById(int customerPaymentId)
        {
            CustomerPaymentDTO customerPaymentDTO = null;
            var customerPayment = unitOfWork.CustomerPaymentRepository.GetById(customerPaymentId);

            if (customerPayment != null)
            {
                customerPaymentDTO = CustomerPaymentConvertor.ConvertToCustomerPaymentDto(customerPayment);
            }
            return(customerPaymentDTO);
        }
Beispiel #2
0
        public List <CustomerPaymentDTO> GetAllCustomerPayments()
        {
            List <CustomerPaymentDTO> customerPaymentsList = new List <CustomerPaymentDTO>();
            var customerPayments = unitOfWork.CustomerPaymentRepository.GetAll();

            if (customerPayments != null)
            {
                foreach (var customerPayment in customerPayments)
                {
                    customerPaymentsList.Add(CustomerPaymentConvertor.ConvertToCustomerPaymentDto(customerPayment));
                }
            }

            return(customerPaymentsList);
        }
Beispiel #3
0
        public List <CustomerPaymentDTO> GetAllCustomerOrders()
        {
            List <CustomerPaymentDTO> customerPaymentsList = new List <CustomerPaymentDTO>();
            var productOrders = unitOfWork.ProductOrderRepository.GetAll();

            if (productOrders != null)
            {
                foreach (var productOrder in productOrders)
                {
                    if (productOrder.InActive == false || productOrder.InActive == null)
                    {
                        List <CustomerPaymentTransaction> customerPaymentTransactions = productOrder.Customer.CustomerPaymentTransactions.Where(x => x.OrderId == productOrder.OrderId).ToList <CustomerPaymentTransaction>();

                        if (customerPaymentTransactions.Where(x => x.OrderId == productOrder.OrderId).Count() > 0)
                        {
                            customerPaymentsList.Add(CustomerPaymentConvertor.ConvertToCustomerPaymentDto(productOrder, customerPaymentTransactions));
                        }
                    }
                }
            }

            return(customerPaymentsList);
        }