示例#1
0
 public static CartItem From(CartItemJson item)
 {
     if (item != null)
     {
         return(new CartItem()
         {
             CartItemId = item.CartItemId,
             CartId = item.CartId,
             AlbumId = item.ItemKey,
             Count = item.Count,
             DateCreated = item.DateCreated
         });
     }
     else
     {
         return(new CartItem()
         {
             CartItemId = 0,
             CartId = string.Empty,
             AlbumId = 0,
             Count = 0,
             DateCreated = DateTime.UtcNow
         });
     }
 }
示例#2
0
        public static CartItemJson From(CartItem item)
        {
            var result = new CartItemJson()
            {
                CartItemId  = item.CartItemId,
                CartId      = item.CartId,
                ItemKey     = item.AlbumId,
                Count       = item.Count,
                DateCreated = item.DateCreated
            };

            return(result);
        }
示例#3
0
        public static List <CartItemJson> From(List <CartItem> items)
        {
            List <CartItemJson> results = new List <CartItemJson>();

            if (items == null)
            {
                return(results);
            }

            foreach (var a in items)
            {
                results.Add(CartItemJson.From(a));
            }
            return(results);
        }