Esempio n. 1
0
 private List <OrderDetail> GetOrderDetails()
 {
     return(CartItems.ConvertAll(item =>
     {
         return new OrderDetail
         {
             Album = db.Albums.Find(item.Album.Id),
             Price = item.Price,
             Amount = item.Amount
         };
     }));
 }
Esempio n. 2
0
 private List <OrderDetail> GetOrderDetails(Member member)
 {
     return(CartItems.ConvertAll(item =>
     {
         //Only Premium member have discount, otherwise no discount.
         int discount = (member.Role == Role.Premium ? item.Product.Discount : 100);
         //double shipping = (member.Role == Role.Premium ? 0 : item.Product.Shipping);
         double price = Math.Round(item.Price * (100 - discount) / 100, 2);
         return new OrderDetail
         {
             Product = db.Products.Find(item.Product.ProductId),
             Price = price,
             Discount = discount,
             TaxPrice = Math.Round(item.Product.Tax * price, 2),
             Shipping = item.Product.Shipping,
             Amount = item.Amount
         };
     }));
 }