public static pw_api_results GetProductByUPC(string UPC) { pw_api_results results = DataAccess.ReadProductWikiByUPC(UPC); if (results == null) { results = GetProductByUPCFromServer(UPC); DataAccess.WriteProductWikiByUPC(UPC,results); } else if (results == null) { results = new pw_api_results(); } return results; }
public static void WriteProductWikiByUPC(string upc,pw_api_results results) { string file = Path.Combine(VAR_PRODUCTWIKI_FILE_PATH, upc + ".json"); File.WriteAllText(file, JavaScriptConvert.SerializeObject(results)); }