Beispiel #1
0
 public bool SetQuantita(ElementoCatalogo p, int q)
 {
     _carrello.TryGetValue(p, out int quantita);
     quantita    += q;
     _carrello[p] = quantita;
     return(_carrello[p] == quantita);
 }
Beispiel #2
0
 public bool AddProdotto(ElementoCatalogo p)
 {
     if (_carrello.ContainsKey(p))
     {
         SetQuantita(p, 1);
     }
     else
     {
         _carrello.Add(p, 1);
     }
     return(_carrello.ContainsKey(p));
 }
Beispiel #3
0
        public override bool Equals(object obj)
        {
            bool result = true;

            if (obj == null || GetType() != obj.GetType())
            {
                result = false;
            }
            ElementoCatalogo e = (ElementoCatalogo)obj;

            if (IdNegozio != e.IdNegozio || IdProdotto != e.IdProdotto)
            {
                result = false;
            }
            return(result);
        }
Beispiel #4
0
 public bool EliminaProdotto(ElementoCatalogo p)
 {
     return(_carrello.Remove(p));
 }