//TODO: GET REAL PRODUCT public Product GetProduct(string name) { string jsonContent = _azuerAzureJsonDataService.GetFileContent(@"products.json"); var products = JsonConvert.DeserializeObject <List <Product> >(jsonContent) ?? new List <Product>(); return(products.First(x => x.Name == name)); }
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"); }