示例#1
0
        public bool CheckEqualProducts(ref JsonProduct product)
        {
            if (id != product.id)
            {
                return(false);
            }

            if (category_id != product.category_id)
            {
                return(false);
            }

            if (title != product.title)
            {
                return(false);
            }

            if (content != product.content)
            {
                return(false);
            }

            if (price != product.price)
            {
                return(false);
            }

            if (old_price != product.old_price)
            {
                return(false);
            }

            if (status != product.status)
            {
                return(false);
            }

            if (keywords != product.keywords)
            {
                return(false);
            }

            if (description != product.description)
            {
                return(false);
            }

            if (img != product.img)
            {
                return(false);
            }

            if (hit != product.hit)
            {
                return(false);
            }

            return(true);
        }
示例#2
0
文件: ApiRequest.cs 项目: Sancene/QC
        public int EditProduct(ref JsonProduct product)
        {
            var json = JsonSerializer.Serialize(product);
            var data = new StringContent(json, Encoding.UTF8);

            Console.WriteLine(data.ReadAsStringAsync().Result);

            var response = client.PostAsync(BASE_URL + "editproduct", data).Result;

            return(response.StatusCode.GetHashCode());
        }
示例#3
0
文件: ApiRequest.cs 项目: Sancene/QC
        public ApiCreateResponse CreateProduct(ref JsonProduct product)
        {
            var json = JsonSerializer.Serialize(product);
            var data = new StringContent(json, Encoding.UTF8);

            Console.WriteLine("PRODUCT CREATION " + data.ReadAsStringAsync().Result);

            var response = client.PostAsync(BASE_URL + "addproduct", data).Result;

            ApiCreateResponse createResponse = JsonSerializer.Deserialize <ApiCreateResponse>(response.Content.ReadAsStringAsync().Result);

            createResponse.statusCode = response.StatusCode.GetHashCode();
            return(createResponse);
        }
示例#4
0
文件: Program.cs 项目: Sancene/QC
        static void Main(string[] args)
        {
            Console.OutputEncoding = Encoding.UTF8;

            JsonProduct json = new JsonProduct();
            string      temp = JsonConvert.SerializeObject(json);

            Console.WriteLine(temp);

            ApiRequest        api            = new ApiRequest();
            ApiCreateResponse createResponse = api.CreateProduct(ref json);

            if (createResponse.statusCode == 200)
            {
                Console.WriteLine("Creation complete");
            }

            Console.WriteLine(createResponse.id);
        }