Esempio n. 1
0
        public SalesDeliveries CreateSalesDeliveriesViewModel(ICollection <SalesDeliveryHeader> salesDeliveries)
        {
            var model = new SalesDeliveries();

            foreach (var sd in salesDeliveries)
            {
                model.SalesDeliveriesViewModel.Add(new SalesDeliveryViewModel()
                {
                    CustomerId    = sd.CustomerId.Value,
                    PaymentTermId = sd.PaymentTermId.HasValue ? sd.PaymentTermId.Value : -1,
                    Date          = sd.Date,
                    Amount        = sd.SalesDeliveryLines.Sum(a => a.Price)
                });
            }

            return(model);
        }
        public SalesDeliveries CreateSalesDeliveriesViewModel(ICollection<SalesDeliveryHeader> salesDeliveries)
        {
            var model = new SalesDeliveries();

            foreach (var sd in salesDeliveries)
            {
                model.SalesDeliveriesViewModel.Add(new SalesDeliveryViewModel()
                {
                    CustomerId = sd.CustomerId.Value,
                    PaymentTermId = sd.PaymentTermId.HasValue ? sd.PaymentTermId.Value : -1,
                    Date = sd.Date,
                    Amount = sd.SalesDeliveryLines.Sum(a => a.Price)
                });
            }

            return model;
        }