public StoreItem GetStoreItem(int id) { try { return(cartdb.GetStoreItem(id)); }catch { return(null); } }
//transfer to db cartItem object public List <CartItem> getCartItems(cCartDetails cart) { var items = new List <CartItem>(); var cItems = cart.cartItems; int order = 1; foreach (var item in cart.cartItems) { items.Add(new CartItem { CartDetailId = cart.Id, CartItemStatusId = cart.CartStatus, ItemOrder = order.ToString(), ItemQty = item.Qty, StoreItemId = item.Id, StoreItem = cartdb.GetStoreItem(item.Id), Remarks1 = item.remarks1, Remarks2 = item.remarks2 }); order++; } return(items); }