private void Flush() { DbFiles dbFiles = new DbFiles(); File.Delete(dbFiles.UserDbFile); List <string> newFile = new List <string>(); foreach (var user in users) { newFile.Add($"{user.Id}," + $"{user.Name}," + $"{user.UserNickname}," + $"{user.Subname}," + $"{user.Password}"); } File.WriteAllLines(dbFiles.UserDbFile, newFile); }
private void Flush() { DbFiles dbFiles = new DbFiles(); File.Delete(dbFiles.MainDbFile); List <string> newFile = new List <string>(); foreach (var data in medicineDb) { newFile.Add($"{data.Id}," + $"{data.MedicineName}," + $"{data.MedicineQuantity}," + $"{data.MedicineQuantityType}," + $"{data.MedicineProducer}," + $"{data.MedicineRefundPossible.ToString().ToLower()}," + $"{data.MedicineRefundPercentage}," + $"{data.MedicinePrice}"); } File.WriteAllLines(dbFiles.MainDbFile, newFile); }