示例#1
0
        public CartInfo GetCartInfo(string items)
        {
            IGetItem readObject = new ReadItemData();
            CartInfo r          = new CartInfo();

            var split = items.Split(',');

            //SubTotal
            double subtotal = 0.0;

            foreach (var item in split)
            {
                //Change this to parse
                var data = readObject.GetItem(Convert.ToInt32(item));
                r.Items.Add(data);
                subtotal += data.ItemPrice;
            }
            r.Subtotal = subtotal;

            //Discount
            //if(user.rewards >= 5)
            //{
            var newTotal = (r.Subtotal * (1 - 0.1));

            //}

            //Tax
            r.Tax = Math.Round((subtotal * 0.1), 2);

            //Rewards
            r.Rewards = (int)((r.Subtotal - (r.Subtotal % 10)) / 10);

            return(r);
        }
示例#2
0
        public Item Get(int id)
        {
            IGetItem readObject = new ReadItemData();

            return(readObject.GetItem(id));
        }