示例#1
0
        private void SaveProduct(Product product)
        {
            AzureJsonDataService azuerAzureJsonDataService = new AzureJsonDataService();
            string jsonContent = azuerAzureJsonDataService.GetFileContent(@"products.json");

            List <Product> productList = JsonConvert.DeserializeObject <List <Product> >(jsonContent) ?? new List <Product>();

            productList.Add(product);
            var ser = JsonConvert.SerializeObject(productList);

            azuerAzureJsonDataService.UpdateFileContent(ser, @"products.json");
        }
示例#2
0
 public PollutionScoreService()
 {
     _azuerAzureJsonDataService = new AzureJsonDataService();
 }