Beispiel #1
0
 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");
     }
 }
Beispiel #2
0
 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);
     }
 }
Beispiel #3
0
 protected IList <Phone> GetPhones(Advertisement adv)
 {
     return(adv.Phones.Where(id => Phones.ContainsKey(id)).Select(id => Phones[id]).ToArray());
 }