public void CheckIfFileExists(FileName fileName) { string path = $@"Dal\{fileName}.json"; if (fileName == FileName.CarComponents) { if (!File.Exists(path)) { ManageStock manageStock = new ManageStock(); Dictionary <string, int> CarComponents = manageStock.CarComponentsDefault(); _ = SaveData(CarComponents, FileName.CarComponents); } } if (fileName == FileName.BusComponents) { if (!File.Exists(path)) { ManageStock manageStock = new ManageStock(); Dictionary <string, int> BusComponents = manageStock.BusComponentsDefault(); _ = SaveData(BusComponents, FileName.BusComponents); } } if (fileName == FileName.TruckComponents) { if (!File.Exists(path)) { ManageStock manageStock = new ManageStock(); Dictionary <string, int> TruckComponents = manageStock.TruckComponentsDefault(); _ = SaveData(TruckComponents, FileName.TruckComponents); } } if (fileName == FileName.MotorbikeComponents) { if (!File.Exists(path)) { ManageStock manageStock = new ManageStock(); Dictionary <string, int> MotorbikeComponents = manageStock.MotorbikeComponentsDefault(); _ = SaveData(MotorbikeComponents, FileName.MotorbikeComponents); } } }