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 }); } }
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); }
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); }