コード例 #1
0
        public string UpdateCartProductQuantity()
        {
            int          productId    = -1;
            String       productColor = "";
            String       productSize  = "";
            int          quantity     = -1;
            MemoryStream stream       = new MemoryStream();

            Request.Body.CopyTo(stream);
            stream.Position = 0;
            using (StreamReader reader = new StreamReader(stream))
            {
                string requestBody = reader.ReadToEnd();
                if (requestBody.Length > 0)
                {
                    var obj = JsonConvert.DeserializeObject <PostData>(requestBody);
                    if (obj != null)
                    {
                        productId    = int.Parse(obj.productId);
                        productColor = obj.productColor;
                        productSize  = obj.productSize;
                        quantity     = int.Parse(obj.quantity);
                    }
                }
            }
            double newPrice = CartProductManager.updateCartProductQuantity(productId, productColor, productSize, quantity);

            return(newPrice + "-" + CartProductManager.getTotalPrice());
        }