private void SaveTransactionFlower(Flower flower, int cost) { Transactions.Add(new Transaction { Name = flower.GetType().Name, Quantity = flower.Quantity, Cost = cost, CurrentDate = DateTime.Now.ToShortDateString() }); }
public void StoreStatisticsFlower(Flower flower, int cost) { var tran = new Transaction(); var flowerName = flower.GetType().Name; var fs = FlowersSales.FirstOrDefault(f => f.Name == flowerName); if (fs == null) { tran.Name = flowerName; tran.Quantity = flower.Quantity; tran.TotalEarnings = cost; FlowersSales.Add(tran); } else { fs.Quantity += flower.Quantity; fs.TotalEarnings += cost; } }