public IHttpActionResult AddToCart(UserItemModel model)
        {
            if (model.Quantity <= 0)
            {
                return(BadRequest("Cannot add 0 or negative quantity"));
            }
            var cartItem = Manager.AddItemToCart(model.UserId, model.ItemId, model.Quantity);

            if (cartItem == null)
            {
                return(BadRequest("Item Not Found"));
            }
            return(Ok("Added " + cartItem.Quantity));
        }
        public string AddItemToCart(int itemId, int count)
        {
            Response response = new Response();

            response.status = false;
            //判断用户权限
            int userId = Convert.ToInt32(HttpContext.Session.GetInt32("id"));

            if (userId != 0)
            {
                ItemManager.AddItemToCart(userId, itemId, count);
                response.message = "添加成功";
                response.status  = true;
            }
            else
            {
                response.message = "请先登录";
            }
            return(JsonConvert.SerializeObject(response));
        }