public static List <Product> CreditOff(int productId) { FileWriters writer = new FileWriters(); ReadFromCsv.ProductList.Where(x => x.Id == productId).ToList().ForEach(x => x.CanBeBoughtOnCredit = false); writer.WriteToProductCsv("../../products.csv", ReadFromCsv.ProductList); return(null); }
public static List <Product> Deactivate(int productId) { StregsystemCLI CLI = new StregsystemCLI(); FileWriters writer = new FileWriters(); ReadFromCsv.ProductList.Where(x => x.Id == productId).ToList().ForEach(x => x.Active = false); writer.WriteToProductCsv("../../products.csv", ReadFromCsv.ProductList); CLI.DisplayAktiveProducts(); return(null); }
public override void Execute() { decimal NewBalance = this.user.Balance + Amount; foreach (var Item in this.UserList.Where(x => x.Id == user.Id)) { Item.Balance = NewBalance; } FileWriters writer = new FileWriters(); //The new information which have been written to the list will over write the old file writer.WriteToUserCsv("../../users.csv", UserList); //The transaction is written to the transaction file writer.WriteToTransactionCsv("../../transactions.csv", this.ToString()); }