public void AddPhone(string vendor, string model, decimal price) { MobilePhones phones = new MobilePhones(vendor, model, price); if(Phones.ContainsKey(List<M>) { Console.WriteLine("Duplicate phone"); } else { Phones.Add(phones); Console.WriteLine("Phone added"); } }
public void AddPhone(string vendor, string model, decimal price) { if (Regex.IsMatch(vendor, validation) && Regex.IsMatch(model, validation) && price >= 0) { string pair = vendor + " " + model; if (Phones.ContainsKey(pair)) { Console.WriteLine("Duplicate phone"); } else { Phones.Add(pair, price); Console.WriteLine("Phone added"); } } else { Console.WriteLine(message); } }
protected IList <Phone> GetPhones(Advertisement adv) { return(adv.Phones.Where(id => Phones.ContainsKey(id)).Select(id => Phones[id]).ToArray()); }