public static DriverProductsDto[] CopyFromEntity(TeleOrder teleOrder) { List <DriverProductsDto> pdtos = new List <DriverProductsDto>(); foreach (TeleOrderDetail det in teleOrder.TeleOrderDetails) { DriverProductsDto pdt = new DriverProductsDto(); pdt.product_id = det.Product.ProdID; pdt.product_name = det.Product.ProductName; pdt.product_promo = det.PromoProduct.HasValue ? det.PromoProduct.Value : 0; pdt.quantity = det.Quantity; pdt.shipping_cost = det.ShippingCharge.HasValue ? det.ShippingCharge.Value : 0; pdt.shipping_promo = det.PromoShipping.HasValue ? det.PromoShipping.Value : 0; pdt.refill_price = det.RefillPrice; pdt.refill_promo = det.PromoRefill; pdt.refill_quantity = det.RefillQuantity; pdt.sub_total = det.SubTotal; pdt.unit_price = det.UnitPrice; pdtos.Add(pdt); } return(pdtos.ToArray()); }
public static DriverProductsDto[] CopyFromEntity(Order order) { List <DriverProductsDto> pdtos = new List <DriverProductsDto>(); foreach (OrderDetail det in order.OrderDetails) { DriverProductsDto pdt = new DriverProductsDto(); pdt.product_id = det.Product.ProdID; // grand_total, delivery_status_id, delivery_timeslot_id pdt.product_name = det.Product.ProductName; pdt.product_promo = det.PromoProduct; pdt.quantity = det.Quantity; pdt.shipping_cost = det.ShippingCharge; pdt.shipping_promo = det.PromoShipping; pdt.refill_price = det.RefillPrice; pdt.refill_promo = det.PromoRefill; pdt.refill_quantity = det.RefillQuantity; pdt.sub_total = det.SubTotal; pdt.unit_price = det.UnitPrice; pdtos.Add(pdt); } return(pdtos.ToArray()); }