public void AddFlower(Flower flower) { if (flower == null) { throw new ArgumentException($"Flower cannot be empty", nameof(flower)); } Flowers.Add(flower); }
private void ReloadFlowers(List<Flower> flowers) { Flowers.Clear(); foreach (var flower in flowers) { Flowers.Add(new FlowerItemViewModel { Description = flower.Description, FlowerId = flower.FlowerId, Price = flower.Price, }); } }
private void ReloadFlowers(List <Flower> flowers) { Flowers.Clear(); //foreach (var flower in flowers) foreach (var flower in flowers.OrderBy(f => f.Description)) { Flowers.Add(new FlowerItemViewModel { Description = flower.Description, FlowerId = flower.FlowerId, Price = flower.Price, Image = flower.Image, IsActive = flower.IsActive, LastPurchase = flower.LastPurchase, Observation = flower.Observation, }); } }
private void OnAdd() { bool exists = false; foreach (Flower flower in Flowers) { if (flower.NameOfFlower.Equals(_enteredFlower)) { exists = true; break; } } if (!exists) { Flowers.Add(new Flower { NameOfFlower = _enteredFlower }); EnteredFlower = string.Empty; } }
public void AddFlower(Flower flower) { Flowers.Add(flower); }
public void AddFlower(Flower f) { Flowers.Add(f); }
public void Add(Flower flower) { Flowers.Add(flower); Price += flower.Price; }